*-------------------------------------------------------------------------------------------------------------*
* The Causal Effects of R&D Grants: Evidence from a regression discontinuity (Santoleri et al., 2020)
*-------------------------------------------------------------------------------------------------------------*

/////////////// Online Appendix


/////////////// Appendix A 

// Table A1: Descriptive statistics on competitions (2014-2017)

use $data_path/DATA_ALL_FINAL.dta, clear

gen id = _n

preserve
collapse (first) phase_smei  (count) id (sum)  n_award=award (mean) award d_first_appl_ph1 d_first_appl_ph2 d_appl_consortium d_win_ph1_apply_ph2 d_win_ph1_win_ph2 d_bab_ph1 d_bab_ph2, by(competition)
label var id "mean \# firms"
label var n_award "mean \# award-winning firms"
label var award "\% award-winning firms"
label var d_first_appl_ph1 "\% first applicants"
label var d_first_appl_ph2 "\% first applicants"
label var d_appl_consortium  "\% firms in consortium"
label var d_win_ph1_apply_ph2 "\% firms that won Phase I"
label var d_win_ph1_win_ph2   "\% firms that won Phase I and II"
label var d_bab_ph1 "\% firms below available budget"
label var d_bab_ph2 "\% firms below available budget"
eststo clear
eststo: estpost summ id  n_award award d_first_appl_ph2 d_appl_consortium d_win_ph1_apply_ph2 /* d_win_ph1_win_ph2 */  d_bab_ph2 if phase_smei==2, det
esttab est1 using $appendix/Table_A1.tex, replace  cells("mean(fmt(2) label(Mean)) sd(fmt(2) label(SD))  p50(fmt(0) label(Median)) count(fmt(0) label(N))" ) nomtitle noobs  varwidth(40) postfoot(\bottomrule \end{tabular}  \end{table})  prefoot("") prehead("\midrule") posthead(\midrule \textbf{Panel A: raw}\\) booktabs nonum  label nolegend
esttab est1 using $appendix/Table_A1.txt, replace  cells("mean(fmt(2) label(Mean)) sd(fmt(2) label(SD))  p50(fmt(0) label(Median)) count(fmt(0) label(N))" ) nomtitle noobs  varwidth(40) nonum  label nolegend
restore


preserve
drop if d_patents_pre==. & d_patents_post==.
collapse (first) phase_smei  (count) id  (sum) n_award=award (mean) award d_first_appl_ph1 d_first_appl_ph2 d_appl_consortium d_win_ph1_apply_ph2 d_win_ph1_win_ph2 d_bab_ph1 d_bab_ph2, by(competition)
label var id "mean \# firms"
label var n_award "mean \# award-winning firms"
label var award "\% award-winning firms"
label var d_first_appl_ph1 "\% first applicants"
label var d_first_appl_ph2 "\% first applicants"
label var d_appl_consortium  "\% firms in consortium"
label var d_win_ph1_apply_ph2 "\% firms that won Phase I"
label var d_win_ph1_win_ph2   "\% firms that won Phase I and II"
label var d_bab_ph1 "\% firms below available budget"
label var d_bab_ph2 "\% firms below available budget"
eststo clear
eststo: estpost summ id  n_award award d_first_appl_ph2 d_appl_consortium d_win_ph1_apply_ph2 /* d_win_ph1_win_ph2 */  d_bab_ph2 if phase_smei==2, det
esttab est1 using $appendix/Table_A1.tex, append cells("mean(fmt(2) label(Mean)) sd(fmt(2) label(SD))  p50(fmt(0) label(Median))  count(fmt(0) label(N))" ) nomtitle noobs  varwidth(40) postfoot("") posthead(\midrule \textbf{Panel B: matched}\\) booktabs  label  nolegend nonotes title(Descriptive statistics on SMEi competitions (2014-2017) - cleaned sample) nonum
esttab est1 using $appendix/Table_A1.txt, append cells("mean(fmt(2) label(Mean)) sd(fmt(2) label(SD))  p50(fmt(0) label(Median))  count(fmt(0) label(N))" ) nomtitle noobs  varwidth(40)  label  nolegend nonotes title(Descriptive statistics on SMEi competitions (2014-2017) - cleaned sample) nonum
restore




// Table A2: Competition topics (2014-2017)

use $data_path/DATA_ALL_FINAL.dta, clear

decode topic, gen(string_topic)
replace string_topic = trim(string_topic)

gen newtopic = .
* Open Disruptive Innovation Scheme
replace newtopic = 1 if string_topic=="SMEInst-01-2016-2017"
replace newtopic = 1 if string_topic=="ICT-37-2014"
replace newtopic = 1 if string_topic=="ICT-37-2015"
replace newtopic = 1 if string_topic=="ICT-37-2014-1"
replace newtopic = 1 if string_topic=="ICT-37-2015-1"
* Nanotechnologies competitions
replace newtopic = 2 if string_topic=="SMEInst-02-2016-2017"
replace newtopic = 2 if string_topic=="NMP-25-2014"
replace newtopic = 2 if string_topic=="NMP-25-2014-1"
replace newtopic = 2 if string_topic=="NMP-25-2015"
replace newtopic = 2 if string_topic=="NMP-25-2015-1"
* Biotech competitions
replace newtopic = 3 if string_topic=="SMEInst-03-2016-2017"
replace newtopic = 3 if string_topic=="BIOTEC-5a-2014"
replace newtopic = 3 if string_topic=="BIOTEC-5a-2014-1"
replace newtopic = 3 if string_topic=="BIOTEC-5b-2015"
replace newtopic = 3 if string_topic=="BIOTEC-5b-2015-1"
* Space competitions
replace newtopic = 4 if string_topic=="SMEInst-04-2016-2017"
replace newtopic = 4 if string_topic=="Space-SME-2014-1"
replace newtopic = 4 if string_topic=="Space-SME-2014-2"
replace newtopic = 4 if string_topic=="Space-SME-2015-1"
replace newtopic = 4 if string_topic=="Space-SME-2015-2"
* Healthcare biotech
replace newtopic = 5 if string_topic=="SMEInst-05-2016-2017"
replace newtopic = 5 if string_topic=="PHC-12-2014"
replace newtopic = 5 if string_topic=="PHC-12-2014-1"
replace newtopic = 5 if string_topic=="PHC-12-2015"
replace newtopic = 5 if string_topic=="PHC-12-2015-1"
* ICT solutions
replace newtopic = 6 if string_topic=="SMEInst-06-2016-2017"
replace newtopic = 6 if string_topic=="PHC-12-2014"
replace newtopic = 6 if string_topic=="PHC-12-2014-1"
replace newtopic = 6 if string_topic=="PHC-12-2015"
replace newtopic = 6 if string_topic=="PHC-12-2015-1"
* Sustainable and competitive agriculture, forestry, agri-food and bio-based sectors
replace newtopic = 7 if string_topic=="SMEInst-07-2016-2017"
replace newtopic = 7 if string_topic=="SFS-08-2014"
replace newtopic = 7 if string_topic=="SFS-08-2014-1"
replace newtopic = 7 if string_topic=="SFS-08-2015"
replace newtopic = 7 if string_topic=="SFS-08-2015-1"
* Blue growth competitions
replace newtopic = 8 if string_topic=="SMEInst-08-2016-2017"
replace newtopic = 8 if string_topic=="BG-12-2014"
replace newtopic = 8 if string_topic=="BG-12-2014-1"
replace newtopic = 8 if string_topic=="BG-12-2015"
replace newtopic = 8 if string_topic=="BG-12-2015-1"
* Low carbon and efficient energy system
replace newtopic = 9 if string_topic=="SMEInst-09-2016-2017"
replace newtopic = 9 if string_topic=="SIE-01-2014"
replace newtopic = 9 if string_topic=="SIE-01-2014-1"
replace newtopic = 9 if string_topic=="SIE-01-2015"
replace newtopic = 9 if string_topic=="SIE-01-2015-1"
* Small business innovation research for Transport and Smart Cities Mobility
replace newtopic = 10 if string_topic=="SMEInst-10-2016-2017"
replace newtopic = 10 if string_topic=="IT-1-2014"
replace newtopic = 10 if string_topic=="IT-1-2014-1"
replace newtopic = 10 if string_topic=="IT-1-2015"
replace newtopic = 10 if string_topic=="IT-1-2015-1"
* Boosting the potential of small businesses in the areas of climate action, environment, resource efficiency and raw materials
replace newtopic = 11 if string_topic=="SMEInst-11-2016-2017"
replace newtopic = 11 if string_topic=="SC5-20-2014"
replace newtopic = 11 if string_topic=="SC5-20-2014-1"
replace newtopic = 11 if string_topic=="SC5-20-2015"
replace newtopic = 11 if string_topic=="SC5-20-2015-1"
* New business models for inclusive, innovative and reflective societies
replace newtopic = 12 if string_topic=="SMEInst-12-2016-2017"
replace newtopic = 12 if string_topic=="INSO-10-2015"
replace newtopic = 12 if string_topic=="INSO-10-2015-1"
replace newtopic = 12 if string_topic=="INSO-9-2015"
replace newtopic = 12 if string_topic=="INSO-9-2015-1"
* Urban critical infrastructures
replace newtopic = 13 if string_topic=="SMEInst-13-2016-2017"
replace newtopic = 13 if string_topic=="DRS-17-2014"
replace newtopic = 13 if string_topic=="DRS-17-2014-1"
replace newtopic = 13 if string_topic=="DRS-17-2015"
replace newtopic = 13 if string_topic=="DRS-17-2015-1"

preserve
drop if phase_smei==1
eststo clear
eststo: estpost tab  newtopic
eststo: estpost tab  newtopic if d_patents_pre!=. & d_patents_post!=.
esttab est1 est2  using $appendix/Table_A2.tex, replace cells("b(label(freq)) pct(fmt(1)) ")       ///
     varlabels(`e(labels)', blist(Total "{hline @width}{break}")) ///
     varwidth(20) nonumber nomtitle noobs
esttab est1 est2  using $appendix/Table_A2.txt, replace cells("b(label(freq)) pct(fmt(1)) ")       ///
     varlabels(`e(labels)', blist(Total "{hline @width}{break}")) ///
     varwidth(20) nonumber nomtitle noobs	 
restore



// Table A3: Comparison between applicants population and sample

use $data_path/DATA_ALL_FINAL.dta, clear

cap drop matched
gen matched = (d_patents_pre!=. & d_patents_post!=.) 
su matched

cap drop fin
gen fin = financial_details_recommended_eu/1000

cap drop loser
gen loser = (award!=1) & rank!=.

label var number_of_participants "Partners"
label var evaluation_history_eu_rank "Uncentered ranks"
label var seal "Seal"
label var year_smei "Application year"
label var loser "Losers"
label var d_appl_consortium "Firms in consortium"
label var north "North"
label var south "South"
label var west "West"
label var east "East"
label var other "Other"
label var fin "Grant amount (th. euros)"
label var cutoff_smei "Cut-off date"

* number of applicants
cap drop applicants
bys competition: gen applicants = _n 
label var applicants "Applicants"
su applicants

* share of firms around threshold
gen local10 = (rank<=10 & rank>=-10)
gen local5 = (rank<=5 & rank>=-5)
label var local10 "Local10"
label var local5 "Local5"

est clear
eststo: estpost summ applicants number_of_participants evaluation_history_eu_rank award local10 local5 d_appl_consortium north south east west other year_smei cutoff_smei fin if phase_smei==2 
eststo: estpost summ applicants number_of_participants evaluation_history_eu_rank award local10 local5 d_appl_consortium north south east west other year_smei cutoff_smei fin if phase_smei==2 & matched==1
esttab est*, star(** 0.05) cells(mean(fmt(2))) 
esttab est* using $appendix/Table_A3.tex, replace cells(mean(fmt(2))) stats(N) varwidth(30) title(Comparison between applicants population and samples) nonumbers label nomtitle
esttab est* using $appendix/Table_A3.txt, replace cells(mean(fmt(2))) stats(N) varwidth(30) title(Comparison between applicants population and samples) nonumbers label nomtitle

* calculate Standardized Differences
est clear
stddiff applicants number_of_participants evaluation_history_eu_rank i.award i.local10 i.local5 i.d_appl_consortium i.north i.south i.east i.west i.other i.year_smei i.cutoff_smei fin if phase_smei==2, by(matched)
matrix list r(stddiff)
matrix mat2 = r(stddiff)

esttab matrix(mat2, f(%9.3f)) using $appendix/Table_A3.tex, append label
esttab matrix(mat2, f(%9.3f)) using $appendix/Table_A3.txt, append label


// Table A4: Applicants’ countries

use $data_path/DATA_ALL_FINAL.dta, clear

preserve
drop if phase_smei==1
eststo clear
eststo: estpost tab coordinator_country
eststo: estpost tab coordinator_country if d_patents_pre!=. & d_patents_post!=.
esttab est1 est2  using $appendix/Table_A4.tex, replace cells("b(label(freq)) pct(fmt(1)) ")       ///
     varlabels(`e(labels)', blist(Total "{hline @width}{break}")) ///
     varwidth(20) nonumber nomtitle noobs
esttab est1 est2  using $appendix/Table_A4.txt, replace cells("b(label(freq)) pct(fmt(1)) ")       ///
     varlabels(`e(labels)', blist(Total "{hline @width}{break}")) ///
     varwidth(20) nonumber nomtitle noobs
restore


// Figure A1: Applicants by centered ranks

use $data_path/DATA_ALL_FINAL.dta, clear

grstyle init newscheme, replace
grstyle set symbolsize 4, pt
grstyle set size 9pt: subheading axis_title tick_label title
grstyle set plain, horizontal nogrid

* Local histograms for ranking variable
cap graph drop _all
twoway (histogram rank if phase_smei==2 & inrange(rank,-30,0),  width(0.2) freq color(edkblue) xline(0)) ///
	(histogram rank if phase_smei==2 & inrange(rank,0,20),   width(0.2) freq color(red)), graphregion(color(white)) legend(off) ///
	xtitle(Centered ranks, height(5) size(medsmall)) title( )  ytitle("") /* ytitle(Number of Observations, size(medsmall)) */ name(hist4)

* Local histograms for ranking variable without firms with missing variables for patents
twoway (histogram rank if phase_smei==2 & ln_citw_patents_post!=. & inrange(rank,-30,0),  width(0.2) freq color(edkblue) xline(0)) ///
	(histogram rank if phase_smei==2 & ln_citw_patents_post!=. & inrange(rank,0,20),   width(0.2) freq color(red)), graphregion(color(white)) legend(off) ///
	xtitle(Centered ranks, height(5) size(medsmall)) title( )  ytitle("") /* ytitle(Number of Observations, size(medsmall)) */ name(hist6)
graph combine hist4 hist6 , col(2) name(gr_combine1, replace) xcommon xsize(12) ysize(5) iscale(*1.3) /* title(Patent weighted count) */
graph export $appendix/Figure_A1.png, replace width(2200)

erase scheme-newscheme.scheme




// Figure A2: RD plots for age and failure

use $data_path/DATA_ALL_FINAL.dta, clear

* set figure style
set scheme s1color  
grstyle init newscheme, replace
grstyle set symbolsize 6, pt
grstyle set size 7pt: title
grstyle set size 13pt: subtitle
grstyle set size 11pt: axis_title
grstyle set plain, horizontal nogrid

label var age_pre "Age" 
label var exit3 "Failure"

* Investment figures
graph drop _all
foreach var of varlist  age_pre exit3 {
cap drop mean_`var'
egen mean_`var' = mean(`var') if phase_smei==2, by(rank)	

twoway  ///
	(lpolyci `var' rank if rank<0 & phase_smei==2 & inrange(rank,-20,10), n(20) deg(2) ker(rec) bwidth(20) fintensity(30)  alw(none) lc(edkblue ..) graphregion(margin(l-4))) || ///
	(lpolyci `var' rank if rank>0 & phase_smei==2 & inrange(rank,-20,10), n(10) deg(2) ker(rec) bwidth(10) fintensity(30)  alw(none) lc(edkblue ..) ) || ///
	scatter mean_`var' rank if  phase_smei==2 & inrange(rank,-20,10), xline(0)  legend(off) msize(vsmall) mcolor(emidblue) name(`var'_2, replace) title(`: variable label `var'' , size(large)) ytitle("") xtitle(Centered ranks, size(medsmall) height(3))
}
graph combine  age_pre_2 exit3_2, col(3) name(gr_combine1, replace) xsize(17) ysize(8) iscale(*1.1) /* title(Patent weighted count) */
graph export $appendix/Figure_A2.png, replace width(2200)

erase scheme-newscheme.scheme



// Figure A3: Graphical evidence of continuity in pre-assignment observables

use $data_path/DATA_ALL_FINAL.dta, clear

* set figure style
set scheme s1color  
grstyle init newscheme, replace
grstyle set symbolsize 6, pt
grstyle set size 3pt: title
grstyle set size 13pt: subtitle
grstyle set size 11pt: axis_title
grstyle set plain, horizontal nogrid

cap drop ln_age
gen ln_age = ln(age_pre + 1)

gen log_gdp_pc = ln(gdp_pc)

label var award "Grant"
label var age_pre "Age$^{Pre}$"
label var cashflow_asset_pre_w "Cash-flow"
label var profitmargin_tm1 "Profit margin"
label var high_tech "High-Tech"
label var south "South"
label var vc_hub "VC Hub"
label var log_gdp_pc "GDP per capita"
	
gen log_requested = ln(financial_details_requested_eu_c)
label var log_requested "Requested funding"

label var d_first_appl_ph2 "First-time applicant" 
label var d_win_ph1_apply_ph2 "Previous Phase I win" 


foreach var of varlist age_pre profitmargin_tm1 south vc_hub high_tech  {
cap drop mean_`var'
egen mean_`var' = mean(`var') if phase_smei==2, by(rank)	

twoway  ///
	(lpolyci `var' rank if rank<0 & phase_smei==2 & inrange(rank,-20,10), n(20) deg(2) ker(rec) bwidth(20) fintensity(30)  alw(none) lc(edkblue ..) graphregion(margin(l-4))) || ///
	(lpolyci `var' rank if rank>0 & phase_smei==2 & inrange(rank,-20,10), n(10) deg(2) ker(rec) bwidth(10) fintensity(30)  alw(none) lc(edkblue ..)) || ///
	scatter mean_`var' rank if  phase_smei==2 & inrange(rank,-20,10), xline(0)  legend(off) msize(vsmall) mcolor(emidblue) name(`var'_2a, replace) title(`: variable label `var'', size(medsmall)) ytitle("") xtitle(Centered ranks, size(small) height(3)) ylabel(, labsize(2.5) ) xlabel(, labsize(2) ) 
}

cap drop mean_cashflow_asset_pre_w
egen mean_cashflow_asset_pre_w = mean(cashflow_asset_pre_w) if phase_smei==2, by(rank)	

twoway  ///
	(lpolyci cashflow_asset_pre_w rank if rank<0 & phase_smei==2 & inrange(rank,-20,10), n(20) deg(2) ker(rec) bwidth(20) fintensity(30)  alw(none) lc(edkblue ..) graphregion(margin(l-13.5))) || ///
	(lpolyci cashflow_asset_pre_w rank if rank>0 & phase_smei==2 & inrange(rank,-20,10), n(10) deg(2) ker(rec) bwidth(10) fintensity(30)  alw(none) lc(edkblue ..)) || ///
	scatter mean_cashflow_asset_pre_w rank if  phase_smei==2 & inrange(rank,-20,10), xline(0)  legend(off) msize(vsmall) mcolor(emidblue) name(cashflow_asset_pre_w_2a, replace) title(`: variable label cashflow_asset_pre_w', size(medsmall)) ytitle("") xtitle(Centered ranks, size(small) height(3))	ylabel(, labsize(2.5) ) xlabel(, labsize(2) ) 


foreach var of varlist log_requested d_first_appl_ph2 d_win_ph1_apply_ph2 log_gdp_pc  {
cap drop mean_`var'
egen mean_`var' = mean(`var') if phase_smei==2, by(rank)	

twoway  ///
	(lpolyci `var' rank if rank<0 & phase_smei==2 & inrange(rank,-20,10), n(20) deg(2) ker(rec) bwidth(20) fintensity(30)  alw(none) lc(edkblue ..) graphregion(margin(l-4))) || ///
	(lpolyci `var' rank if rank>0 & phase_smei==2 & inrange(rank,-20,10), n(10) deg(2) ker(rec) bwidth(10) fintensity(30)  alw(none) lc(edkblue ..)) || ///
	scatter mean_`var' rank if  phase_smei==2 & inrange(rank,-20,10), xline(0)  legend(off) msize(vsmall) mcolor(emidblue) name(`var'_2a, replace) title(`: variable label `var'', size(medsmall)) ytitle("") xtitle(Centered ranks, size(small) height(3)) ylabel(, labsize(2.5) ) xlabel(, labsize(2) ) 
}

graph combine  profitmargin_tm1_2a cashflow_asset_pre_w_2a south_2a  vc_hub_2a high_tech_2a log_gdp_pc_2a log_requested_2a d_first_appl_ph2_2a /*d_win_ph1_apply_ph2_2a*/ ,  graphregion(color(white) margin(vsmall)) cols(2)  xsize(7) ysize(10) iscale(*.9)
graph export $appendix/Figure_A3.png, replace width(2200)
cap graph close

erase scheme-newscheme.scheme




//// Figure A4

set scheme s1color  
grstyle init newscheme, replace
grstyle set symbolsize 6, pt
grstyle set size 7pt: title
grstyle set size 13pt: subtitle
grstyle set size 11pt: axis_title
grstyle set plain, horizontal nogrid

label var ln_citw_patents_pre_w "Cite-weighted Patents"
label var pe_pre "Private Equity"
label var assets_pre_w "Assets"
label var employees_pre_w "Employees"
label var revenues_pre_w "Revenues"
label var investment_pre_w "Investment"
label var investment_post_w "Investment"
label var age_pre "Age" 

graph drop _all
foreach var of varlist ln_citw_patents_pre_w pe_pre assets_pre_w employees_pre_w revenues_pre_w age_pre {
cap drop mean_`var'
egen mean_`var' = mean(`var') if phase_smei==2, by(sealrank)	

twoway  ///
	(lpolyci `var' sealrank if sealrank<0 & phase_smei==2 & inrange(sealrank,-20,10) & (award!=1 | seal==1) & sumseal==1, n(20) deg(2) ker(rec) bwidth(20) fintensity(30)  alw(none) lc(edkblue ..) graphregion(margin(l-4))) || ///
	(lpolyci `var' sealrank if sealrank>0 & phase_smei==2 & inrange(sealrank,-20,10) & (award!=1 | seal==1) & sumseal==1, n(10) deg(2) ker(rec) bwidth(10) fintensity(30)  alw(none) lc(edkblue ..)) || ///
	scatter mean_`var' sealrank if  phase_smei==2 & inrange(sealrank,-20,10) & (award!=1 | seal==1) & sumseal==1, xline(0)  legend(off) msize(vsmall) mcolor(emidblue) name(`var'_2, replace) title(`: variable label `var'') ytitle("") xtitle(Centered ranks, size(medsmall) height(3))
}
graph combine ln_citw_patents_pre_w_2 pe_pre_2 assets_pre_w_2 employees_pre_w_2 revenues_pre_w_2 age_pre_2, col(3)  name(gr_combine1, replace) xsize(15) ysize(10) iscale(*.8) title(Panel A. Pre-SOE, size(small) margin(b=3)) plotregion(margin(-2 -2 -2 -2))
graph export $appendix/Figure_A4.png, replace width(2200)

erase scheme-newscheme.scheme



/// Table A5: Balancing tests of baseline observables and pre-award outcomes

use $data_path/DATA_ALL_FINAL.dta, clear

* list of pre-determined variables
global balance ln_citw_patents_pre_w pe_pre revenues_pre_w assets_pre_w employees_pre_w  ln_age  cashflow_asset_pre_w profitmargin_tm1  high_tech  /*south*/ log_gdp_pc vc_hub  

* controls for polinomyal orders on both sides of the threshold
global linear    c.sealrank#i.seal
global quadratic c.sealrank#i.seal c.sealrank#c.sealrank#i.seal

gen log_gdp_pc = ln(gdp_pc)

* regression loops reproducing Table A5
cap erase $appendix/Table_A5.txt
cap erase $appendix/Table_A5.tex
eststo clear
foreach var of varlist $balance {
    est clear
	eststo: reghdfe `var' seal $linear if phase_smei==2 & (award!=1 | seal==1) & sumseal==1, a(competition) cluster(competition)
	eststo: reghdfe `var' seal $linear if phase_smei==2 & (award!=1 | seal==1) & sumseal==1 & inrange(sealrank, -10,10) , a(competition) cluster(competition)
	eststo: reghdfe `var' seal $linear if phase_smei==2 & (award!=1 | seal==1) & sumseal==1 & inrange(sealrank, -5,5) , a(competition) cluster(competition)
	eststo: reghdfe `var' seal $quadratic if phase_smei==2 & (award!=1 | seal==1) & sumseal==1, a(competition) cluster(competition)
	eststo: reghdfe `var' seal $quadratic if phase_smei==2 & (award!=1 | seal==1) & sumseal==1 & inrange(sealrank, -10,10) , a(competition) cluster(competition)
	eststo: reghdfe `var' seal $quadratic if phase_smei==2 & (award!=1 | seal==1) & sumseal==1 & inrange(sealrank, -5,5) , a(competition) cluster(competition)
	esttab est* using $appendix/Table_A5.txt, append star(* 0.10 ** 0.05 *** 0.01 ) b(3) se(3) keep(seal) stat( ) title(`e(depvar)' Phase `i') mtitles(All 10 5 All 10 5 ) ///
	coeflabels(seal "Seal") varwidth(25) nonote
	esttab est* using $appendix/Table_A5.tex, append star(* 0.10 *** 0.01 ) b(3) se(3) keep(seal) stat( ) title(`e(depvar)' ) mtitles(All 10 5 All 10 5 ) ///
	coeflabels(seal "Seal") varwidth(25) nonote
}




/////////////// Appendix B



// Table B1: The effects on investment over longer time span

use $data_path/DATA_ALL_FINAL.dta, clear

eststo clear
foreach ranks in   "i.award#c.rank" "i.award#c.rank i.award#c.rank#c.rank" "i.quintile" {
		eststo: qui reghdfe investment_post2_w award `ranks'  fixed_assets_pre_w if phase_smei==2 , a(competition) cluster(competition) 
}
eststo: qui reghdfe investment_post2_w award $linear			     fixed_assets_pre_w  if phase_smei==2  & inrange(rank, -10,10), cluster(competition)  a(competition)
eststo: qui reghdfe investment_post2_w award $quadratic  fixed_assets_pre_w  if phase_smei==2  & inrange(rank, -10,10), cluster(competition)  a(competition)
eststo: qui reghdfe investment_post2_w award $linear			    fixed_assets_pre_w if phase_smei==2  & inrange(rank, -5,5), cluster(competition)  a(competition)
eststo: qui reghdfe investment_post2_w award $quadratic   fixed_assets_pre_w if phase_smei==2  & inrange(rank, -5,5), cluster(competition)  a(competition)
estfe . est*, labels(competition "Competition FE")
esttab est* using $appendix/Table_B1.tex, replace star(* 0.10 ** 0.05 *** 0.01 ) b(3) se(3) stats(N N_clust r2 bic, fmt(0 0 2) labels(N "\# competitions" "R-squared" "BIC")) coeflabels(award "Grant" rank "Rank" c.rank#c.rank "Rank$^2$" 1.award#c.rank "Rank $\times$ Grant" 0.award#c.rank "Rank $\times$ NoAward" 1.award#c.rank#c.rank "Rank$^2$ $\times$ Award" 0.award#c.rank#c.rank "Rank$^2$ $\times$ NoAward")  mtitles(All All All 10 10 5 5 ) drop(_cons ) postfoot(\bottomrule \end{tabular}  \end{table})  prefoot(\midrule) prehead("\midrule") posthead(\midrule \textbf{Panel B: Phase II}\\) booktabs indicate( "Rank $\times$ Grant=*award#c.rank" "Rank^{2} $\times$ Award=*.award#c.rank#c.rank" "Rank quintiles=*.quintile"  "Pre-award= fixed_assets_pre_w" `r(indicate_fe)') varwidth(25)
esttab est* using $appendix/Table_B1.txt, replace star(* 0.10 ** 0.05 *** 0.01 ) b(3) se(3) stats(N N_clust r2 bic, fmt(0 0 2) labels(N "\# competitions" "R-squared" "BIC")) coeflabels(award "Grant" rank "Rank" c.rank#c.rank "Rank$^2$" 1.award#c.rank "Rank $\times$ Grant" 0.award#c.rank "Rank $\times$ NoAward" 1.award#c.rank#c.rank "Rank$^2$ $\times$ Award" 0.award#c.rank#c.rank "Rank$^2$ $\times$ NoAward")  mtitles(All All All 10 10 5 5 ) drop(_cons *.competition) indicate( "Rank $\times$ Grant=*award#c.rank" "Rank^{2} $\times$ Award=*.award#c.rank#c.rank" "Rank quintiles=*.quintile"  "Pre-award= fixed_assets_pre_w" `r(indicate_fe)') varwidth(25)


// Table B2: The effects on investment in tangibles

use $data_path/DATA_ALL_FINAL.dta, clear

* tangible inv scaled by pre-program assets
cap drop net_investment_tan_t* investment_tan_post*
gen net_investment_tan_t = ( tangiblefixedassets_t )  - ( tangiblefixedassets_tm1 ) 
gen net_investment_tan_tp1 = ( tangiblefixedassets_tp1 )  - ( tangiblefixedassets_t )
gen investment_tan_post = (net_investment_tan_t + net_investment_tan_tp1 ) / totalassets_tm1 
winsor2 investment_tan_post , cuts(2 98)

eststo clear
foreach ranks in   "i.award#c.rank" "i.award#c.rank i.award#c.rank#c.rank" "i.quintile" {
		eststo: qui reghdfe investment_tan_post_w award `ranks'  fixed_assets_pre_w if phase_smei==2  , a(competition) cluster(competition) 
}
eststo: qui reghdfe investment_tan_post_w award $linear			     fixed_assets_pre_w  if phase_smei==2  & inrange(rank, -10,10), cluster(competition)  a(competition)
eststo: qui reghdfe investment_tan_post_w award $quadratic  fixed_assets_pre_w  if phase_smei==2  & inrange(rank, -10,10), cluster(competition)  a(competition)
eststo: qui reghdfe investment_tan_post_w award $linear			    fixed_assets_pre_w if phase_smei==2  & inrange(rank, -5,5), cluster(competition)  a(competition)
eststo: qui reghdfe investment_tan_post_w award $quadratic   fixed_assets_pre_w if phase_smei==2  & inrange(rank, -5,5), cluster(competition)  a(competition)
estfe . est*, labels(competition "Competition FE")
esttab est* using $appendix/Table_B2.tex, replace star(* 0.10 ** 0.05 *** 0.01 ) b(3) se(3) stats(N N_clust r2 bic, fmt(0 0 2) labels(N "\# competitions" "R-squared" "BIC")) coeflabels(award "Grant" rank "Rank" c.rank#c.rank "Rank$^2$" 1.award#c.rank "Rank $\times$ Grant" 0.award#c.rank "Rank $\times$ NoAward" 1.award#c.rank#c.rank "Rank$^2$ $\times$ Award" 0.award#c.rank#c.rank "Rank$^2$ $\times$ NoAward")  mtitles(All All All 10 10 5 5 ) drop(_cons ) postfoot(\bottomrule \end{tabular}  \end{table})  prefoot(\midrule) prehead("\midrule") posthead(\midrule \textbf{Panel B: Phase II}\\) booktabs indicate( "Rank $\times$ Grant=*award#c.rank" "Rank^{2} $\times$ Award=*.award#c.rank#c.rank" "Rank quintiles=*.quintile"  "Pre-award= fixed_assets_pre_w" `r(indicate_fe)') varwidth(25)
esttab est* using $appendix/Table_B2.txt, replace star(* 0.10 ** 0.05 *** 0.01 ) b(3) se(3) stats(N N_clust r2 bic, fmt(0 0 2) labels(N "\# competitions" "R-squared" "BIC")) coeflabels(award "Grant" rank "Rank" c.rank#c.rank "Rank$^2$" 1.award#c.rank "Rank $\times$ Grant" 0.award#c.rank "Rank $\times$ NoAward" 1.award#c.rank#c.rank "Rank$^2$ $\times$ Award" 0.award#c.rank#c.rank "Rank$^2$ $\times$ NoAward")  mtitles(All All All 10 10 5 5 ) drop(_cons *.competition)  indicate( "Rank $\times$ Grant=*award#c.rank" "Rank^{2} $\times$ Award=*.award#c.rank#c.rank" "Rank quintiles=*.quintile"  "Pre-award= fixed_assets_pre_w" `r(indicate_fe)') varwidth(25)


// Table B3: The effects on investment in intangibles

use $data_path/DATA_ALL_FINAL.dta, clear

* intangible inv scaled by pre-program assets
cap drop net_investment_int_t* investment_int_post*
gen net_investment_int_t = ( intangiblefixedassets_t )  - ( intangiblefixedassets_tm1 ) 
gen net_investment_int_tp1 = ( intangiblefixedassets_tp1 )  - ( intangiblefixedassets_t )
gen investment_int_post = (net_investment_int_t + net_investment_int_tp1 ) / totalassets_tm1 
winsor2 investment_int_post , cuts(2 98)

eststo clear
foreach ranks in   "i.award#c.rank" "i.award#c.rank i.award#c.rank#c.rank" "i.quintile" {
		eststo: qui reghdfe investment_int_post_w award `ranks'  fixed_assets_pre_w if phase_smei==2  , a(competition) cluster(competition) 
}
eststo: qui reghdfe investment_int_post_w award $linear			     fixed_assets_pre_w  if phase_smei==2  & inrange(rank, -10,10), cluster(competition)  a(competition)
eststo: qui reghdfe investment_int_post_w award $quadratic fixed_assets_pre_w  if phase_smei==2  & inrange(rank, -10,10), cluster(competition)  a(competition)
eststo: qui reghdfe investment_int_post_w award $linear			    fixed_assets_pre_w if phase_smei==2  & inrange(rank, -5,5), cluster(competition)  a(competition)
eststo: qui reghdfe investment_int_post_w award $quadratic   fixed_assets_pre_w if phase_smei==2  & inrange(rank, -5,5), cluster(competition)  a(competition)
estfe . est*, labels(competition "Competition FE")
esttab est* using $appendix/Table_B3.tex, replace star(* 0.10 ** 0.05 *** 0.01 ) b(3) se(3) stats(N N_clust r2 bic, fmt(0 0 2) labels(N "\# competitions" "R-squared" "BIC")) coeflabels(award "Grant" rank "Rank" c.rank#c.rank "Rank$^2$" 1.award#c.rank "Rank $\times$ Grant" 0.award#c.rank "Rank $\times$ NoAward" 1.award#c.rank#c.rank "Rank$^2$ $\times$ Award" 0.award#c.rank#c.rank "Rank$^2$ $\times$ NoAward")  mtitles(All All All 10 10 5 5 ) drop(_cons ) postfoot(\bottomrule \end{tabular}  \end{table})  prefoot(\midrule) prehead("\midrule") posthead(\midrule \textbf{Panel B: Phase II}\\) booktabs indicate( "Rank $\times$ Grant=*award#c.rank" "Rank^{2} $\times$ Award=*.award#c.rank#c.rank" "Rank quintiles=*.quintile"  "Pre-award= fixed_assets_pre_w" `r(indicate_fe)') varwidth(25)
esttab est* using $appendix/Table_B3.txt, replace star(* 0.10 ** 0.05 *** 0.01 ) b(3) se(3) stats(N N_clust r2 bic, fmt(0 0 2) labels(N "\# competitions" "R-squared" "BIC")) coeflabels(award "Grant" rank "Rank" c.rank#c.rank "Rank$^2$" 1.award#c.rank "Rank $\times$ Grant" 0.award#c.rank "Rank $\times$ NoAward" 1.award#c.rank#c.rank "Rank$^2$ $\times$ Award" 0.award#c.rank#c.rank "Rank$^2$ $\times$ NoAward")  mtitles(All All All 10 10 5 5 ) drop(_cons *.competition)  indicate( "Rank $\times$ Grant=*award#c.rank" "Rank^{2} $\times$ Award=*.award#c.rank#c.rank" "Rank quintiles=*.quintile"  "Pre-award= fixed_assets_pre_w" `r(indicate_fe)') varwidth(25)




// Table B4: Additional results on patenting

use $data_path/DATA_ALL_FINAL.dta, clear


eststo clear
foreach var in "ln_citw_patents"  {

eststo:  qui reghdfe `var'_post_w award $linear     `var'_pre_w if phase_smei==2, a(competition) cluster(competition)
eststo:  qui reghdfe `var'_post_w award $quadratic  `var'_pre_w    if phase_smei==2, a(competition  ) cluster(competition)
eststo:  qui reghdfe `var'_post_w award $linear	    `var'_pre_w if phase_smei==2  & inrange(rank, -10,10), a(competition) cluster(competition)
eststo:  qui reghdfe `var'_post_w award $quadratic  `var'_pre_w    if phase_smei==2  & inrange(rank, -10,10), a(competition  ) cluster(competition)
eststo:  qui reghdfe `var'_post_w award $linear	    `var'_pre_w if phase_smei==2  & inrange(rank, -5,5), a(competition) cluster(competition)
eststo:  qui reghdfe `var'_post_w award $quadratic  `var'_pre_w    if phase_smei==2  & inrange(rank, -5,5), a(competition  ) cluster(competition)
}
esttab est* using $appendix/Table_B4.tex, replace star(* 0.10 ** 0.05 *** 0.01 ) b(3) se(3) stats(N bic r2, fmt(0 2) labels(N "BIC" "R-squared" )) keep(award award) coeflabels(award "Grant" ) mtitles(All All 10 10 All All 10 10)   prehead(\begin{table}[htbp]\centering \def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi} \caption{Alternative standard error clustering} \begin{tabular}{l*{9}{c}} \toprule) postfoot("") posthead(\midrule ) booktabs nonotes  varwidth(25)
esttab est* using $appendix/Table_B4.txt, replace star(* 0.10 ** 0.05 *** 0.01 ) b(3) se(3) stats(N bic r2, fmt(0 2) labels(N "BIC" "R-squared" )) keep(award award) coeflabels(award "Grant" ) mtitles(All All 10 10 All All 10 10)    nonotes  varwidth(25)

cap drop new_ln_citw_patents_pre* new_ln_citw_patents_post*
gen new_ln_citw_patents_pre = ln(0.75 + citw_patents_pre)
gen new_ln_citw_patents_post = ln(0.75 + citw_patents_post)
winsor2 new_ln_citw_patents_pre new_ln_citw_patents_post, cuts(0 98)

eststo clear
foreach var in "new_ln_citw_patents"  {

eststo:  qui reghdfe `var'_post_w award $linear     `var'_pre_w if phase_smei==2, a(competition) cluster(competition)
eststo:  qui reghdfe `var'_post_w award $quadratic  `var'_pre_w    if phase_smei==2, a(competition  ) cluster(competition)
eststo:  qui reghdfe `var'_post_w award $linear	    `var'_pre_w if phase_smei==2  & inrange(rank, -10,10), a(competition) cluster(competition)
eststo:  qui reghdfe `var'_post_w award $quadratic  `var'_pre_w    if phase_smei==2  & inrange(rank, -10,10), a(competition  ) cluster(competition)
eststo:  qui reghdfe `var'_post_w award $linear	    `var'_pre_w if phase_smei==2  & inrange(rank, -5,5), a(competition) cluster(competition)
eststo:  qui reghdfe `var'_post_w award $quadratic  `var'_pre_w    if phase_smei==2  & inrange(rank, -5,5), a(competition  ) cluster(competition)
}
esttab est* using $appendix/Table_B4.tex, append star(* 0.10 ** 0.05 *** 0.01 ) b(3) se(3) stats(N bic r2, fmt(0 2) labels(N "BIC" "R-squared" )) keep(award award) coeflabels(award "Grant" ) mtitles(All All 10 10 All All 10 10)   prehead(\begin{table}[htbp]\centering \def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi} \caption{Alternative standard error clustering} \begin{tabular}{l*{9}{c}} \toprule) postfoot("") posthead(\midrule ) booktabs nonotes  varwidth(25)
esttab est* using $appendix/Table_B4.txt, append star(* 0.10 ** 0.05 *** 0.01 ) b(3) se(3) stats(N bic r2, fmt(0 2) labels(N "BIC" "R-squared" )) keep(award award) coeflabels(award "Grant" ) mtitles(All All 10 10 All All 10 10)   nonotes  varwidth(25)

cap drop new_ln_citw_patents_pre* new_ln_citw_patents_post*
gen new_ln_citw_patents_pre = ln(0.5 + citw_patents_pre)
gen new_ln_citw_patents_post = ln(0.5 + citw_patents_post)
winsor2 new_ln_citw_patents_pre new_ln_citw_patents_post, cuts(0 98)

eststo clear
foreach var in "new_ln_citw_patents"  {

eststo:  qui reghdfe `var'_post_w award $linear     `var'_pre_w if phase_smei==2, a(competition) cluster(competition)
eststo:  qui reghdfe `var'_post_w award $quadratic  `var'_pre_w    if phase_smei==2, a(competition  ) cluster(competition)
eststo:  qui reghdfe `var'_post_w award $linear	    `var'_pre_w if phase_smei==2  & inrange(rank, -10,10), a(competition) cluster(competition)
eststo:  qui reghdfe `var'_post_w award $quadratic  `var'_pre_w    if phase_smei==2  & inrange(rank, -10,10), a(competition  ) cluster(competition)
eststo:  qui reghdfe `var'_post_w award $linear	    `var'_pre_w if phase_smei==2  & inrange(rank, -5,5), a(competition) cluster(competition)
eststo:  qui reghdfe `var'_post_w award $quadratic  `var'_pre_w    if phase_smei==2  & inrange(rank, -5,5), a(competition  ) cluster(competition)
}
esttab est* using $appendix/Table_B4.tex, append star(* 0.10 ** 0.05 *** 0.01 ) b(3) se(3) stats(N bic r2, fmt(0 2) labels(N "BIC" "R-squared" )) keep(award award) coeflabels(award "Grant" ) mtitles(All All 10 10 All All 10 10)   prehead(\begin{table}[htbp]\centering \def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi} \caption{Alternative standard error clustering} \begin{tabular}{l*{9}{c}} \toprule) postfoot("") posthead(\midrule ) booktabs nonotes  varwidth(25)
esttab est* using $appendix/Table_B4.txt, append star(* 0.10 ** 0.05 *** 0.01 ) b(3) se(3) stats(N bic r2, fmt(0 2) labels(N "BIC" "R-squared" )) keep(award award) coeflabels(award "Grant" ) mtitles(All All 10 10 All All 10 10)   nonotes  varwidth(25)

cap drop new_ln_citw_patents_pre* new_ln_citw_patents_post*
gen new_ln_citw_patents_pre = ln(0.25 + citw_patents_pre)
gen new_ln_citw_patents_post = ln(0.25 + citw_patents_post)
winsor2 new_ln_citw_patents_pre new_ln_citw_patents_post, cuts(0 98)

eststo clear
foreach var in "new_ln_citw_patents"  {

eststo:  qui reghdfe `var'_post_w award $linear     `var'_pre_w if phase_smei==2, a(competition) cluster(competition)
eststo:  qui reghdfe `var'_post_w award $quadratic  `var'_pre_w    if phase_smei==2, a(competition  ) cluster(competition)
eststo:  qui reghdfe `var'_post_w award $linear	    `var'_pre_w if phase_smei==2  & inrange(rank, -10,10), a(competition) cluster(competition)
eststo:  qui reghdfe `var'_post_w award $quadratic  `var'_pre_w    if phase_smei==2  & inrange(rank, -10,10), a(competition  ) cluster(competition)
eststo:  qui reghdfe `var'_post_w award $linear	    `var'_pre_w if phase_smei==2  & inrange(rank, -5,5), a(competition) cluster(competition)
eststo:  qui reghdfe `var'_post_w award $quadratic  `var'_pre_w    if phase_smei==2  & inrange(rank, -5,5), a(competition  ) cluster(competition)
}
esttab est* using $appendix/Table_B4.tex, append star(* 0.10 ** 0.05 *** 0.01 ) b(3) se(3) stats(N bic r2, fmt(0 2) labels(N "BIC" "R-squared" )) keep(award award) coeflabels(award "Grant" ) mtitles(All All 10 10 All All 10 10)   prehead(\begin{table}[htbp]\centering \def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi} \caption{Alternative standard error clustering} \begin{tabular}{l*{9}{c}} \toprule) postfoot("") posthead(\midrule ) booktabs nonotes  varwidth(25)
esttab est* using $appendix/Table_B4.txt, append star(* 0.10 ** 0.05 *** 0.01 ) b(3) se(3) stats(N bic r2, fmt(0 2) labels(N "BIC" "R-squared" )) keep(award award) coeflabels(award "Grant" ) mtitles(All All 10 10 All All 10 10)   nonotes  varwidth(25)

cap drop new_ln_citw_patents_pre* new_ln_citw_patents_post*
gen new_ln_citw_patents_pre = ln(0.1 + citw_patents_pre)
gen new_ln_citw_patents_post = ln(0.1 + citw_patents_post)
winsor2 new_ln_citw_patents_pre new_ln_citw_patents_post, cuts(0 98)

eststo clear
foreach var in "new_ln_citw_patents"  {

eststo:  qui reghdfe `var'_post_w award $linear     `var'_pre_w if phase_smei==2, a(competition) cluster(competition)
eststo:  qui reghdfe `var'_post_w award $quadratic  `var'_pre_w    if phase_smei==2, a(competition  ) cluster(competition)
eststo:  qui reghdfe `var'_post_w award $linear	    `var'_pre_w if phase_smei==2  & inrange(rank, -10,10), a(competition) cluster(competition)
eststo:  qui reghdfe `var'_post_w award $quadratic  `var'_pre_w    if phase_smei==2  & inrange(rank, -10,10), a(competition  ) cluster(competition)
eststo:  qui reghdfe `var'_post_w award $linear	    `var'_pre_w if phase_smei==2  & inrange(rank, -5,5), a(competition) cluster(competition)
eststo:  qui reghdfe `var'_post_w award $quadratic  `var'_pre_w    if phase_smei==2  & inrange(rank, -5,5), a(competition  ) cluster(competition)
}
esttab est* using $appendix/Table_B4.tex, append star(* 0.10 ** 0.05 *** 0.01 ) b(3) se(3) stats(N bic r2, fmt(0 2) labels(N "BIC" "R-squared" )) keep(award award) coeflabels(award "Grant" ) mtitles(All All 10 10 All All 10 10)   prehead(\begin{table}[htbp]\centering \def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi} \caption{Alternative standard error clustering} \begin{tabular}{l*{9}{c}} \toprule) postfoot("") posthead(\midrule ) booktabs nonotes  varwidth(25)
esttab est* using $appendix/Table_B4.txt, append star(* 0.10 ** 0.05 *** 0.01 ) b(3) se(3) stats(N bic r2, fmt(0 2) labels(N "BIC" "R-squared" )) keep(award award) coeflabels(award "Grant" ) mtitles(All All 10 10 All All 10 10)   nonotes  varwidth(25)


* IHS
cap drop ihs_citw_patents_post_w ihs_citw_patents_pre_w
gen ihs_citw_patents_post_w = log(citw_patents_post_w + sqrt(citw_patents_post_w^2 + 1))
gen ihs_citw_patents_pre_w  = log(citw_patents_pre_w + sqrt(citw_patents_pre_w^2 + 1))

eststo clear
foreach var in "ihs_citw_patents"  {

eststo:  qui reghdfe `var'_post_w award $linear     `var'_pre_w if phase_smei==2, a(competition) cluster(competition)
eststo:  qui reghdfe `var'_post_w award $quadratic  `var'_pre_w    if phase_smei==2, a(competition  ) cluster(competition)
eststo:  qui reghdfe `var'_post_w award $linear	    `var'_pre_w if phase_smei==2  & inrange(rank, -10,10), a(competition) cluster(competition)
eststo:  qui reghdfe `var'_post_w award $quadratic  `var'_pre_w    if phase_smei==2  & inrange(rank, -10,10), a(competition  ) cluster(competition)
eststo:  qui reghdfe `var'_post_w award $linear	    `var'_pre_w if phase_smei==2  & inrange(rank, -5,5), a(competition) cluster(competition)
eststo:  qui reghdfe `var'_post_w award $quadratic  `var'_pre_w    if phase_smei==2  & inrange(rank, -5,5), a(competition  ) cluster(competition)
}
esttab est* using $appendix/Table_B4.tex, append star(* 0.10 ** 0.05 *** 0.01 ) b(3) se(3) stats(N bic r2, fmt(0 2) labels(N "BIC" "R-squared" )) keep(award award) coeflabels(award "Grant" ) mtitles(All All 10 10 All All 10 10)   prehead(\begin{table}[htbp]\centering \def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi} \caption{Alternative standard error clustering} \begin{tabular}{l*{9}{c}} \toprule) postfoot("") posthead(\midrule ) booktabs nonotes  varwidth(25)
esttab est* using $appendix/Table_B4.txt, append star(* 0.10 ** 0.05 *** 0.01 ) b(3) se(3) stats(N bic r2, fmt(0 2) labels(N "BIC" "R-squared" )) keep(award award) coeflabels(award "Grant" ) mtitles(All All 10 10 All All 10 10)   nonotes  varwidth(25)

cap drop citw_patents_post_w citw_patents_pre_w
winsor2 citw_patents_post citw_patents_pre,  cuts(0 97)

eststo clear
foreach var in "citw_patents"  {

eststo:  qui ppmlhdfe `var'_post_w award $linear     `var'_pre_w if phase_smei==2, a(competition) cluster(competition)
eststo:  qui ppmlhdfe `var'_post_w award $quadratic  `var'_pre_w    if phase_smei==2, a(competition  ) cluster(competition)
eststo:  qui ppmlhdfe `var'_post_w award $linear	    `var'_pre_w if phase_smei==2  & inrange(rank, -10,10), a(competition) cluster(competition)
eststo:  qui ppmlhdfe `var'_post_w award $quadratic  `var'_pre_w    if phase_smei==2  & inrange(rank, -10,10), a(competition  ) cluster(competition)
eststo:  qui ppmlhdfe `var'_post_w award $linear	    `var'_pre_w if phase_smei==2  & inrange(rank, -5,5), a(competition) cluster(competition)
eststo:  qui ppmlhdfe `var'_post_w award $quadratic  `var'_pre_w    if phase_smei==2  & inrange(rank, -5,5), a(competition  ) cluster(competition)
}
esttab est* using $appendix/Table_B4.tex, append star(* 0.10 ** 0.05 *** 0.01 ) b(3) se(3) stats(N bic r2_p, fmt(0 2) labels(N "BIC" "R-squared" )) keep(award award) coeflabels(award "Grant" ) mtitles(All All 10 10 All All 10 10)   prehead(\begin{table}[htbp]\centering \def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi} \caption{Alternative standard error clustering} \begin{tabular}{l*{9}{c}} \toprule) postfoot("") posthead(\midrule ) booktabs nonotes  varwidth(25)
esttab est* using $appendix/Table_B4.txt, append star(* 0.10 ** 0.05 *** 0.01 ) b(3) se(3) stats(N bic r2, fmt(0 2) labels(N "BIC" "R-squared" )) keep(award award) coeflabels(award "Grant" ) mtitles(All All 10 10 All All 10 10)   nonotes  varwidth(25)

* NBREG - Effect of the SMEi on cite-weighted patents - Phase 2
eststo clear
foreach ranks in   "i.award#c.rank" "i.award#c.rank i.award#c.rank#c.rank" {
		eststo:  qui nbreg citw_patents_post_w award `ranks' citw_patents_pre_w i.competition  if phase_smei==2, cluster(competition)
}
eststo:  qui nbreg citw_patents_post_w award  $linear   		   citw_patents_pre_w i.competition  if phase_smei==2 & inrange(rank,-10,10), cluster(competition)
eststo:  qui nbreg citw_patents_post_w award  $quadratic citw_patents_pre_w i.competition  if phase_smei==2 & inrange(rank,-10,10), cluster(competition)
eststo:  qui nbreg citw_patents_post_w award  $linear		   citw_patents_pre_w i.competition  if phase_smei==2 & inrange(rank,-5,5), cluster(competition)
eststo:  qui nbreg citw_patents_post_w award  $quadratic citw_patents_pre_w i.competition  if phase_smei==2 & inrange(rank,-5,5), cluster(competition)
esttab est* using $appendix/Table_B4.tex, append star(* 0.10 ** 0.05 *** 0.01 ) b(3) se(3) stats(N bic r2_p, fmt(0 2) labels(N "BIC" "R-squared" )) keep(award award) coeflabels(award "Grant" ) mtitles(All All 10 10 All All 10 10)   prehead(\begin{table}[htbp]\centering \def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi} \caption{Alternative standard error clustering} \begin{tabular}{l*{9}{c}} \toprule) postfoot("") posthead(\midrule ) booktabs nonotes  varwidth(25)
esttab est* using $appendix/Table_B4.txt, append star(* 0.10 ** 0.05 *** 0.01 ) b(3) se(3) stats(N bic r2, fmt(0 2) labels(N "BIC" "R-squared" )) keep(award award) coeflabels(award "Grant" ) mtitles(All All 10 10 All All 10 10)   nonotes  varwidth(25)



// Table B5: The effects on cite-weighted patents (two-year citation window)

use $data_path/DATA_ALL_FINAL.dta, clear

gen pat_2years_pre = ln(pat_citw_tm1 + pat_citw_tm2 + pat_citw_tm3 + pat_citw_tm4 + 1)
replace pat_2years_pre = 0 if pat_2years_pre==. & ln_citw_patents_pre_w!=.
gen pat_2years_post = ln(pat_citw_tp1 + pat_citw_tp2 + 1)
replace pat_2years_post = 0 if pat_2years_post==. & ln_citw_patents_post_w!=.

winsor2 pat_2years_pre pat_2years_post , cuts(0 98)

su pat_2years_pre pat_2years_post

eststo clear
foreach var in "pat_2years_post_w"  {
eststo: reghdfe `var' award $linear  pat_2years_pre_w if phase_smei==2, a(competition) cluster(competition) 
eststo: reghdfe `var' award $quadratic  pat_2years_pre_w if phase_smei==2, a(competition) cluster(competition) 
eststo: reghdfe `var' award i.quintile  pat_2years_pre_w if phase_smei==2, a(competition) cluster(competition) 
eststo: reghdfe `var' award $linear   pat_2years_pre_w if phase_smei==2 & inrange(rank,-10,10), a(competition) cluster(competition) 
eststo: reghdfe `var' award $quadratic  pat_2years_pre_w if phase_smei==2 & inrange(rank,-10,10), a(competition) cluster(competition) 
eststo: reghdfe `var' award $linear  pat_2years_pre_w if phase_smei==2 & inrange(rank,-5,5), a(competition) cluster(competition) 
eststo: reghdfe `var' award $quadratic  pat_2years_pre_w if phase_smei==2 & inrange(rank,-5,5), a(competition) cluster(competition) 
}
esttab est* using $appendix/Table_B5.tex, replace star(* 0.10 ** 0.05 *** 0.01 ) b(3) se(3) stats(N bic r2, fmt(0 2) labels(N "BIC" "R-squared" )) keep(award award) coeflabels(award "Grant" ) mtitles(All All 10 10 All All 10 10) prehead(\begin{table}[htbp]\centering \def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi} \caption{Alternative standard error clustering} \begin{tabular}{l*{9}{c}} \toprule) postfoot("") posthead(\midrule ) booktabs nonotes  varwidth(25)
esttab est* using $appendix/Table_B5.txt, replace star(* 0.10 ** 0.05 *** 0.01 ) b(3) se(3) stats(N bic r2, fmt(0 2) labels(N "BIC" "R-squared" )) keep(award award) coeflabels(award "Grant" ) mtitles(All All 10 10 All All 10 10) nonotes  varwidth(25)




// Table B6: The effects on patents (count)

use $data_path/DATA_ALL_FINAL.dta, clear

eststo clear
foreach ranks in   "i.award#c.rank" "i.award#c.rank i.award#c.rank#c.rank" "i.quintile" {
		eststo: qui reghdfe ln_n_patents_post_w award `ranks' ln_n_patents_pre_w if phase_smei==2 , a(competition) cluster(competition) 
}
eststo: qui reghdfe ln_n_patents_post_w award $linear 		   	    ln_n_patents_pre_w if phase_smei==2  & inrange(rank, -10,10), cluster(competition)  a(competition)
eststo: qui reghdfe ln_n_patents_post_w award $quadratic ln_n_patents_pre_w if phase_smei==2  & inrange(rank, -10,10), cluster(competition)  a(competition)
eststo: qui reghdfe ln_n_patents_post_w award $linear  		  	    ln_n_patents_pre_w if phase_smei==2  & inrange(rank, -5,5), cluster(competition)  a(competition)
eststo: qui reghdfe ln_n_patents_post_w award $quadratic ln_n_patents_pre_w if phase_smei==2  & inrange(rank, -5,5), cluster(competition)  a(competition)
estfe . est*, labels(competition "Competition FE")
esttab est* using $appendix/Table_B6.tex, replace star(* 0.10 ** 0.05 *** 0.01 ) b(3) se(3) stats(N N_clust r2 bic, fmt(0 0 2) labels(N "\# competitions" "R-squared" "BIC")) coeflabels(award "Grant" rank "Rank" c.rank#c.rank "Rank$^2$" 1.award#c.rank "Rank $\times$ Award" 0.award#c.rank "Rank $\times$ NoAward" 1.award#c.rank#c.rank "Rank$^2$ $\times$ Award" 0.award#c.rank#c.rank "Rank$^2$ $\times$ NoAward")  mtitles(All All All 10 10 5 5 ) drop(_cons ) postfoot(\bottomrule \end{tabular}  \end{table})  prefoot(\midrule) prehead("\midrule") posthead(\midrule \textbf{Panel B: Phase II}\\) booktabs indicate( "Rank $\times$ Award=*award#c.rank" "Rank^{2} $\times$ Award=*.award#c.rank#c.rank" "Rank quintiles=*.quintile"  "Pre-award=ln_n_patents_pre_w" `r(indicate_fe)') varwidth(25)
esttab est* using $appendix/Table_B6.txt, replace star(* 0.10 ** 0.05 *** 0.01 ) b(3) se(3) stats(N N_clust r2 bic, fmt(0 0 2) labels(N "\# competitions" "R-squared" "BIC")) coeflabels(award "Grant" rank "Rank" c.rank#c.rank "Rank$^2$" 1.award#c.rank "Rank $\times$ Award" 0.award#c.rank "Rank $\times$ NoAward" 1.award#c.rank#c.rank "Rank$^2$ $\times$ Award" 0.award#c.rank#c.rank "Rank$^2$ $\times$ NoAward")  mtitles(All All All 10 10 5 5 ) drop(_cons *.competition ) indicate( "Rank $\times$ Award=*award#c.rank" "Rank^{2} $\times$ Award=*.award#c.rank#c.rank" "Rank quintiles=*.quintile"  "Pre-award=ln_n_patents_pre_w" `r(indicate_fe)') varwidth(25)



// Table B7:  The effects on patents (dummy)

use $data_path/DATA_ALL_FINAL.dta, clear

eststo clear
foreach ranks in   "i.award#c.rank" "i.award#c.rank i.award#c.rank#c.rank" "i.quintile" {
		eststo: qui reghdfe d_patents_post award `ranks' d_patents_pre if phase_smei==2 , a(competition) cluster(competition) 
}
eststo: qui reghdfe d_patents_post award $linear 		   	    d_patents_pre if phase_smei==2  & inrange(rank, -10,10), cluster(competition)  a(competition)
eststo: qui reghdfe d_patents_post award $quadratic d_patents_pre if phase_smei==2  & inrange(rank, -10,10), cluster(competition)  a(competition)
eststo: qui reghdfe d_patents_post award $linear 		  	    d_patents_pre if phase_smei==2  & inrange(rank, -5,5), cluster(competition)  a(competition)
eststo: qui reghdfe d_patents_post award $quadratic d_patents_pre if phase_smei==2  & inrange(rank, -5,5), cluster(competition)  a(competition)
estfe . est*, labels(competition "Competition FE")
esttab est* using $appendix/Table_B7.tex, replace star(* 0.10 ** 0.05 *** 0.01 ) b(3) se(3) stats(N N_clust r2 bic, fmt(0 0 2) labels(N "\# competitions" "R-squared" "BIC")) coeflabels(award "Grant" rank "Rank" c.rank#c.rank "Rank$^2$" 1.award#c.rank "Rank $\times$ Award" 0.award#c.rank "Rank $\times$ NoAward" 1.award#c.rank#c.rank "Rank$^2$ $\times$ Award" 0.award#c.rank#c.rank "Rank$^2$ $\times$ NoAward")  mtitles(All All All 10 10 5 5 ) drop(_cons ) postfoot(\bottomrule \end{tabular}  \end{table})  prefoot(\midrule) prehead("\midrule") posthead(\midrule \textbf{Panel B: Phase II}\\) booktabs indicate( "Rank $\times$ Award=*award#c.rank" "Rank^{2} $\times$ Award=*.award#c.rank#c.rank" "Rank quintiles=*.quintile"  "Pre-award=d_patents_pre" `r(indicate_fe)') varwidth(25)
esttab est* using $appendix/Table_B7.txt, replace star(* 0.10 ** 0.05 *** 0.01 ) b(3) se(3) stats(N N_clust r2 bic, fmt(0 0 2) labels(N "\# competitions" "R-squared" "BIC")) coeflabels(award "Grant" rank "Rank" c.rank#c.rank "Rank$^2$" 1.award#c.rank "Rank $\times$ Award" 0.award#c.rank "Rank $\times$ NoAward" 1.award#c.rank#c.rank "Rank$^2$ $\times$ Award" 0.award#c.rank#c.rank "Rank$^2$ $\times$ NoAward")  mtitles(All All All 10 10 5 5 ) drop(_cons *.competition) indicate( "Rank $\times$ Award=*award#c.rank" "Rank^{2} $\times$ Award=*.award#c.rank#c.rank" "Rank quintiles=*.quintile"  "Pre-award=d_patents_pre" `r(indicate_fe)') varwidth(25)





// Table B8: The effects on the extensive margin for patents

use $data_path/DATA_ALL_FINAL.dta, clear

eststo clear
eststo: reghdfe d_patents_post award $linear			       if phase_smei==2 & d_patents_pre==0, cluster(competition)  a(competition)
eststo: reghdfe d_patents_post award $quadratic      if phase_smei==2 & d_patents_pre==0, cluster(competition)  a(competition)
eststo: reghdfe d_patents_post award $linear			       if phase_smei==2 & d_patents_pre==0 & inrange(rank, -10,10), cluster(competition)  a(competition)
eststo: reghdfe d_patents_post award $quadratic      if phase_smei==2 & d_patents_pre==0 & inrange(rank, -10,10), cluster(competition)  a(competition)
eststo: reghdfe d_patents_post award $linear		       if phase_smei==2 & d_patents_pre==1, cluster(competition)  a(competition)
eststo: reghdfe d_patents_post award $quadratic      if phase_smei==2 & d_patents_pre==1, cluster(competition)  a(competition)
eststo: reghdfe d_patents_post award $linear			       if phase_smei==2 & d_patents_pre==1 & inrange(rank, -10,10), cluster(competition)  a(competition)
eststo: reghdfe d_patents_post award $quadratic      if phase_smei==2 & d_patents_pre==1 & inrange(rank, -10,10), cluster(competition)  a(competition)
esttab est* , star(* 0.10 ** 0.05 *** 0.01) stats(N bic) keep(award) se
estfe . est*, labels(competition "Competition FE")
esttab est* using $appendix/Table_B8.tex, replace star(* 0.10 ** 0.05 *** 0.01 ) b(3) se(3) stats(N N_clust r2 bic, fmt(0 0 2) labels(N "\# competitions" "R-squared" "BIC")) coeflabels(award "Grant" rank "Rank" c.rank#c.rank "Rank$^2$" 1.award#c.rank "Rank $\times$ Award" 0.award#c.rank "Rank $\times$ NoAward" 1.award#c.rank#c.rank "Rank$^2$ $\times$ Award" 0.award#c.rank#c.rank "Rank$^2$ $\times$ NoAward")  mtitles(All All 10 10 All All 10 10 ) drop(_cons ) postfoot(\bottomrule \end{tabular}  \end{table})  prefoot(\midrule) prehead("\midrule") posthead(\midrule \textbf{Panel B: Phase II}\\) booktabs indicate( "Rank $\times$ Award=*award#c.rank" "Rank^{2} $\times$ Award=*.award#c.rank#c.rank"   `r(indicate_fe)') varwidth(25)
esttab est* using $appendix/Table_B8.txt, replace star(* 0.10 ** 0.05 *** 0.01 ) b(3) se(3) stats(N N_clust r2 bic, fmt(0 0 2) labels(N "\# competitions" "R-squared" "BIC")) coeflabels(award "Grant" rank "Rank" c.rank#c.rank "Rank$^2$" 1.award#c.rank "Rank $\times$ Award" 0.award#c.rank "Rank $\times$ NoAward" 1.award#c.rank#c.rank "Rank$^2$ $\times$ Award" 0.award#c.rank#c.rank "Rank$^2$ $\times$ NoAward")  mtitles(All All 10 10 All All 10 10 ) drop(_cons *.competition) indicate( "Rank $\times$ Award=*award#c.rank" "Rank^{2} $\times$ Award=*.award#c.rank#c.rank"   `r(indicate_fe)') varwidth(25)



// Table B9: The effects on private equity amount

use $data_path/DATA_ALL_FINAL.dta, clear

eststo clear
foreach ranks in   "i.award#c.rank" "i.award#c.rank i.award#c.rank#c.rank" "i.quintile" {
		eststo: qui reghdfe ln_pe_post_amount award `ranks' ln_pe_pre_amount if phase_smei==2 , a(competition) cluster(competition) 
}
eststo: qui reghdfe ln_pe_post_amount award $linear		   	    ln_pe_pre_amount if phase_smei==2  & inrange(rank, -10,10), cluster(competition)  a(competition)
eststo: qui reghdfe ln_pe_post_amount award $quadratic ln_pe_pre_amount if phase_smei==2  & inrange(rank, -10,10), cluster(competition)  a(competition)
eststo: qui reghdfe ln_pe_post_amount award $linear 		  	    ln_pe_pre_amount if phase_smei==2  & inrange(rank, -5,5), cluster(competition)  a(competition)
eststo: qui reghdfe ln_pe_post_amount award $quadratic ln_pe_pre_amount if phase_smei==2  & inrange(rank, -5,5), cluster(competition)  a(competition)
estfe . est*, labels(competition "Competition FE")
esttab est* using $appendix/Table_B9.tex, replace star(* 0.10 ** 0.05 *** 0.01 ) b(3) se(3) stats(N N_clust r2 bic, fmt(0 0 2) labels(N "\# competitions" "R-squared" "BIC")) coeflabels(award "Grant" rank "Rank" c.rank#c.rank "Rank$^2$" 1.award#c.rank "Rank $\times$ Award" 0.award#c.rank "Rank $\times$ NoAward" 1.award#c.rank#c.rank "Rank$^2$ $\times$ Award" 0.award#c.rank#c.rank "Rank$^2$ $\times$ NoAward")  mtitles(All All All 10 10 5 5 ) drop(_cons ) postfoot(\bottomrule \end{tabular}  \end{table})  prefoot(\midrule) prehead("\midrule") posthead(\midrule \textbf{Panel B: Phase II}\\) booktabs indicate( "Rank $\times$ Award=*award#c.rank" "Rank^{2} $\times$ Award=*.award#c.rank#c.rank" "Rank quintiles=*.quintile"  "Pre-award=ln_pe_pre_amount" `r(indicate_fe)') varwidth(25)
esttab est* using $appendix/Table_B9.txt, replace star(* 0.10 ** 0.05 *** 0.01 ) b(3) se(3) stats(N N_clust r2 bic, fmt(0 0 2) labels(N "\# competitions" "R-squared" "BIC")) coeflabels(award "Grant" rank "Rank" c.rank#c.rank "Rank$^2$" 1.award#c.rank "Rank $\times$ Award" 0.award#c.rank "Rank $\times$ NoAward" 1.award#c.rank#c.rank "Rank$^2$ $\times$ Award" 0.award#c.rank#c.rank "Rank$^2$ $\times$ NoAward")  mtitles(All All All 10 10 5 5 ) drop(_cons *.competition) indicate( "Rank $\times$ Award=*award#c.rank" "Rank^{2} $\times$ Award=*.award#c.rank#c.rank" "Rank quintiles=*.quintile"  "Pre-award=ln_pe_pre_amount" `r(indicate_fe)') varwidth(25)


// Table B10: The effects on private equity deals

use $data_path/DATA_ALL_FINAL.dta, clear

eststo clear
foreach ranks in   "i.award#c.rank" "i.award#c.rank i.award#c.rank#c.rank" "i.quintile" {
		eststo: qui reghdfe pe_deal_post award `ranks' pe_deal_pre if phase_smei==2 , a(competition) cluster(competition) 
}
eststo: qui reghdfe pe_deal_post award $linear		   	    pe_deal_pre if phase_smei==2  & inrange(rank, -10,10), cluster(competition)  a(competition)
eststo: qui reghdfe pe_deal_post award $quadratic pe_deal_pre if phase_smei==2  & inrange(rank, -10,10), cluster(competition)  a(competition)
eststo: qui reghdfe pe_deal_post award $linear 	  	    pe_deal_pre if phase_smei==2  & inrange(rank, -5,5), cluster(competition)  a(competition)
eststo: qui reghdfe pe_deal_post award $quadratic pe_deal_pre if phase_smei==2  & inrange(rank, -5,5), cluster(competition)  a(competition)
estfe . est*, labels(competition "Competition FE")
esttab est* using $appendix/Table_B10.tex, replace star(* 0.10 ** 0.05 *** 0.01 ) b(3) se(3) stats(N N_clust r2 bic, fmt(0 0 2) labels(N "\# competitions" "R-squared" "BIC")) coeflabels(award "Grant" rank "Rank" c.rank#c.rank "Rank$^2$" 1.award#c.rank "Rank $\times$ Award" 0.award#c.rank "Rank $\times$ NoAward" 1.award#c.rank#c.rank "Rank$^2$ $\times$ Award" 0.award#c.rank#c.rank "Rank$^2$ $\times$ NoAward")  mtitles(All All All 10 10 5 5 ) drop(_cons ) postfoot(\bottomrule \end{tabular}  \end{table})  prefoot(\midrule) prehead("\midrule") posthead(\midrule \textbf{Panel B: Phase II}\\) booktabs indicate( "Rank $\times$ Award=*award#c.rank" "Rank^{2} $\times$ Award=*.award#c.rank#c.rank" "Rank quintiles=*.quintile"  "Pre-award=pe_deal_pre" `r(indicate_fe)') varwidth(25)
esttab est* using $appendix/Table_B10.txt, replace star(* 0.10 ** 0.05 *** 0.01 ) b(3) se(3) stats(N N_clust r2 bic, fmt(0 0 2) labels(N "\# competitions" "R-squared" "BIC")) coeflabels(award "Grant" rank "Rank" c.rank#c.rank "Rank$^2$" 1.award#c.rank "Rank $\times$ Award" 0.award#c.rank "Rank $\times$ NoAward" 1.award#c.rank#c.rank "Rank$^2$ $\times$ Award" 0.award#c.rank#c.rank "Rank$^2$ $\times$ NoAward")  mtitles(All All All 10 10 5 5 ) drop(_cons *.competition) indicate( "Rank $\times$ Award=*award#c.rank" "Rank^{2} $\times$ Award=*.award#c.rank#c.rank" "Rank quintiles=*.quintile"  "Pre-award=pe_deal_pre" `r(indicate_fe)') varwidth(25)


/// Table B11: The effects on firm failure

use $data_path/DATA_ALL_FINAL.dta, clear

* dependent var, treatment var, pre-treatment var
local dvar9 exit3 award

* controls for polinomyal orders on both sides of the threshold
global linear    c.rank#i.award
global quadratic c.rank#i.award c.rank#c.rank#i.award

* regression loops reproducing Tables B11
est clear
    forv i=2/2 {
             eststo est`d'_`i'_1: qui reghdfe exit3 award $linear    if phase_smei==`i', a(competition) cluster(competition)
			 eststo est`d'_`i'_2: qui reghdfe exit3 award $quadratic if phase_smei==`i', a(competition) cluster(competition)
			 eststo est`d'_`i'_3: qui reghdfe exit3 award i.quintile if phase_smei==`i', a(competition) cluster(competition)
			 eststo est`d'_`i'_4: qui reghdfe exit3 award $linear    if phase_smei==`i' & inrange(rank,-10,10), a(competition) cluster(competition)
			 eststo est`d'_`i'_5: qui reghdfe exit3 award $quadratic if phase_smei==`i' & inrange(rank,-10,10), a(competition) cluster(competition)
			 eststo est`d'_`i'_6: qui reghdfe exit3 award $linear    if phase_smei==`i' & inrange(rank,-5,5), a(competition) cluster(competition)
			 eststo est`d'_`i'_7: qui reghdfe exit3 award $quadratic if phase_smei==`i' & inrange(rank,-5,5), a(competition) cluster(competition)
}

* display results of Table B11 in .txt format
cap erase $output/Table_B11.txt $output/Table_B11.tex
esttab est* using $output/Table_B11.txt, replace star(* 0.10 ** 0.05 *** 0.01 ) b(3) se(3) keep(award) stat(N r2 bic, fmt(0 2 2)) title(The effects on firm failure) mtitles(All All All 10 10 5 5 ) ///
coeflabels(award "Grant") indicate( "Rank x Grant=*award#c.rank" "Rank2 x Grant=*.award#c.rank#c.rank" "Rank quintiles=*.quintile" ) varwidth(25) nonotes
* display results of Table B11 in .tex format
esttab est* using $output/Table_B11.tex, replace star(* 0.10 ** 0.05 *** 0.01 ) b(3) se(3) stats(N   r2 bic, fmt(0 2 2) labels(N "R-squared" "BIC")) keep(award) ///
coeflabels(award "Grant") mtitles(All All All 10 10 5 5 ) prehead(\begin{table}[htbp]\centering \def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi} \caption{The effects on firm failure} \begin{tabular}{l*{9}{c}} \toprule) ///
postfoot(\bottomrule \end{tabular}  \end{table}) posthead(\midrule) booktabs nonotes indicate( "Rank $\times$ Grant=*.award#c.rank" "Rank^{2} $\times$ Grant=*.award#c.rank#c.rank" "Rank quintiles=*.quintile"  ) varwidth(25)




// Table B12: The effects on IPO

use $data_path/DATA_ALL_FINAL.dta, clear

eststo clear
foreach ranks in   "i.award#c.rank" "i.award#c.rank i.award#c.rank#c.rank" "i.quintile" {
		eststo: qui reghdfe ipo_post award `ranks'   if phase_smei==2 , a(competition) cluster(competition) 
}
eststo: qui reghdfe ipo_post award $linear			        if phase_smei==2  & inrange(rank, -10,10), cluster(competition)  a(competition)
eststo: qui reghdfe ipo_post award $quadratic    if phase_smei==2  & inrange(rank, -10,10), cluster(competition)  a(competition)
eststo: qui reghdfe ipo_post award $linear			        if phase_smei==2  & inrange(rank, -5,5), cluster(competition)  a(competition)
eststo: qui reghdfe ipo_post award $quadratic    if phase_smei==2  & inrange(rank, -5,5), cluster(competition)  a(competition)
estfe . est*, labels(competition "Competition FE")
esttab est* using $appendix/Table_B12.tex, replace star(* 0.10 ** 0.05 *** 0.01 ) b(3) se(3) stats(N N_clust r2 bic, fmt(0 0 2) labels(N "\# competitions" "R-squared" "BIC")) coeflabels(award "Grant" rank "Rank" c.rank#c.rank "Rank$^2$" 1.award#c.rank "Rank $\times$ Award" 0.award#c.rank "Rank $\times$ NoAward" 1.award#c.rank#c.rank "Rank$^2$ $\times$ Award" 0.award#c.rank#c.rank "Rank$^2$ $\times$ NoAward")  mtitles(All All All 10 10 5 5 ) drop(_cons ) postfoot(\bottomrule \end{tabular}  \end{table})  prefoot(\midrule) prehead("\midrule") posthead(\midrule \textbf{Panel B: Phase II}\\) booktabs indicate( "Rank $\times$ Award=*award#c.rank" "Rank^{2} $\times$ Award=*.award#c.rank#c.rank" "Rank quintiles=*.quintile"  "Pre-award= " `r(indicate_fe)') varwidth(25)
esttab est* using $appendix/Table_B12.txt, replace star(* 0.10 ** 0.05 *** 0.01 ) b(3) se(3) stats(N N_clust r2 bic, fmt(0 0 2) labels(N "\# competitions" "R-squared" "BIC")) coeflabels(award "Grant" rank "Rank" c.rank#c.rank "Rank$^2$" 1.award#c.rank "Rank $\times$ Award" 0.award#c.rank "Rank $\times$ NoAward" 1.award#c.rank#c.rank "Rank$^2$ $\times$ Award" 0.award#c.rank#c.rank "Rank$^2$ $\times$ NoAward")  mtitles(All All All 10 10 5 5 ) drop(_cons *.competition) indicate( "Rank $\times$ Award=*award#c.rank" "Rank^{2} $\times$ Award=*.award#c.rank#c.rank" "Rank quintiles=*.quintile"  "Pre-award= " `r(indicate_fe)') varwidth(25)


// Table B13: The effects on M&A

use $data_path/DATA_ALL_FINAL.dta, clear

eststo clear
foreach ranks in   "i.award#c.rank" "i.award#c.rank i.award#c.rank#c.rank" "i.quintile" {
		eststo: qui reghdfe mea_post award `ranks'   if phase_smei==2 , a(competition) cluster(competition) 
}
eststo: qui reghdfe mea_post award $linear			        if phase_smei==2  & inrange(rank, -10,10), cluster(competition)  a(competition)
eststo: qui reghdfe mea_post award $quadratic    if phase_smei==2  & inrange(rank, -10,10), cluster(competition)  a(competition)
eststo: qui reghdfe mea_post award $linear			        if phase_smei==2  & inrange(rank, -5,5), cluster(competition)  a(competition)
eststo: qui reghdfe mea_post award $quadratic    if phase_smei==2  & inrange(rank, -5,5), cluster(competition)  a(competition)
estfe . est*, labels(competition "Competition FE")
esttab est* using $appendix/Table_B13.tex, replace star(* 0.10 ** 0.05 *** 0.01 ) b(3) se(3) stats(N N_clust r2 bic, fmt(0 0 2) labels(N "\# competitions" "R-squared" "BIC")) coeflabels(award "Grant" rank "Rank" c.rank#c.rank "Rank$^2$" 1.award#c.rank "Rank $\times$ Award" 0.award#c.rank "Rank $\times$ NoAward" 1.award#c.rank#c.rank "Rank$^2$ $\times$ Award" 0.award#c.rank#c.rank "Rank$^2$ $\times$ NoAward")  mtitles(All All All 10 10 5 5 ) drop(_cons ) postfoot(\bottomrule \end{tabular}  \end{table})  prefoot(\midrule) prehead("\midrule") posthead(\midrule \textbf{Panel B: Phase II}\\) booktabs indicate( "Rank $\times$ Award=*award#c.rank" "Rank^{2} $\times$ Award=*.award#c.rank#c.rank" "Rank quintiles=*.quintile"  "Pre-award= " `r(indicate_fe)') varwidth(25)
esttab est* using $appendix/Table_B13.txt, replace star(* 0.10 ** 0.05 *** 0.01 ) b(3) se(3) stats(N N_clust r2 bic, fmt(0 0 2) labels(N "\# competitions" "R-squared" "BIC")) coeflabels(award "Grant" rank "Rank" c.rank#c.rank "Rank$^2$" 1.award#c.rank "Rank $\times$ Award" 0.award#c.rank "Rank $\times$ NoAward" 1.award#c.rank#c.rank "Rank$^2$ $\times$ Award" 0.award#c.rank#c.rank "Rank$^2$ $\times$ NoAward")  mtitles(All All All 10 10 5 5 ) drop(_cons *.competition) indicate( "Rank $\times$ Award=*award#c.rank" "Rank^{2} $\times$ Award=*.award#c.rank#c.rank" "Rank quintiles=*.quintile"  "Pre-award= " `r(indicate_fe)') varwidth(25)





// Figure B1-B2: Treatment effects over time

use $data_path/DATA_ALL_FINAL.dta, clear

* compute dep vars in log levels
gen assets_post1 = ln(totalassets_t)
gen assets_post2 = ln(totalassets_tp1)
gen assets_post3 = ln(totalassets_tp2)

gen revenues_post1 = ln(opturnover_t)
gen revenues_post2 = ln(opturnover_tp1)
gen revenues_post3 = ln(opturnover_tp2)

gen employees_post1 = ln(numberofemployees_t)
gen employees_post2 = ln(numberofemployees_tp1)
gen employees_post3 = ln(numberofemployees_tp2)

foreach var of varlist assets_post* revenues_post* employees_post*  {
		winsor2 `var', cuts(2 98) suff(_w)
}



rename pe_t pe_1
rename pe_tp1 pe_2
rename pe_tp2 pe_3
rename pe_tp3 pe_4

gen ln_pat_tm1 = ln(patent_tm1 + patent_tm2 + patent_tm3 + patent_tm4 + patent_tm5 + 1)
replace ln_pat_tm1 = 0 if ln_pat_tm1==. & ln_citw_patents_pre_w!=.

gen ln_pat_1 = ln(patent_t + 1)
replace ln_pat_1 = 0 if patent_t==. & ln_citw_patents_pre_w!=.
gen ln_pat_2 = ln(patent_tp1 + patent_t + 1)
replace ln_pat_2 = 0 if patent_tp1==. & ln_citw_patents_post_w!=.
gen ln_pat_3 = ln(patent_tp2 + patent_tp1 + patent_t + 1)
replace ln_pat_3 = 0 if patent_tp2==. & ln_citw_patents_post_w!=.

winsor2 ln_pat_tm1 ln_pat_1 ln_pat_2 ln_pat_3, cuts(0 98)

gen investment_1 = investment_t / totalassets_tm1
gen investment_2 = investment_tp1 / totalassets_tm1
gen investment_3 = investment_tp2 / totalassets_tm1
winsor2 investment_1 investment_2 investment_3, cuts(2 98)


* set figure style
graph set window fontface default
set scheme s2color  
grstyle init newscheme, replace
grstyle set symbolsize 6, pt
grstyle set size 7pt: title
grstyle set size 13pt: subtitle
grstyle set size 11pt: axis_title
grstyle set plain, horizontal nogrid

* Private equity
cap graph drop _all
eststo clear
foreach t of numlist 1 2 3  {
			eststo time`t': qui reghdfe pe_`t' award i.award#c.rank i.award#c.rank#c.rank  pe_pre if phase_smei==2 , a(competition) cluster(competition) 
			local pe1 `pe1' time`t' ||
			local labels `labels' `t'
}
coefplot `pe1' , name(pe1) keep(award ) vertical  format(%4.2f) bycoefs bylabels(`labels') xlabel(1 "t" 2 "t+1" 3 "t+2", labsize(vlarge)   ) ylabel(, labsize(medlarge)) ciopts(recast(rcap) lcolor(gs6) lwidth(*2)) legend(off) msize(vlarge)  title(Private Equity (linear), size(huge)) graphregion( margin(vsmall))
eststo clear
foreach t of numlist 1 2 3   {
			eststo time`t': qui reghdfe pe_`t' award i.award#c.rank  i.award#c.rank#c.rank pe_pre if phase_smei==2 & inrange(rank, -10,10), a(competition) cluster(competition) 
			local pe2 `pe2' time`t' ||
			local labels `labels' `t'
}
coefplot `pe2'  , name(pe2) keep(award ) vertical  format(%4.2f) bycoefs bylabels(`labels') xlabel(1 "t" 2 "t+1" 3 "t+2", labsize(vlarge)   ) ylabel(, labsize(medlarge))  ciopts(recast(rcap) lcolor(gs6) lwidth(*2)) legend(off)  msize(vlarge) title(Private Equity (quadratic), size(huge)) graphregion( margin(vsmall))

graph combine pe1 pe2    , col(2) xsize(12) ysize(6) ycommon
graph export $appendix/6_Time_PE2.png, replace width(1000)

* Patent
eststo clear
foreach t of numlist 1 2 3  {
			eststo time`t': qui reghdfe ln_pat_`t'_w award i.award#c.rank ln_pat_tm1_w if phase_smei==2 , a(competition) cluster(competition) 
			local patent1 `patent1' time`t' ||
			local labels `labels' `t'
}
coefplot `patent1' , name(patent1) keep(award ) vertical  format(%4.2f) bycoefs bylabels(`labels') xlabel(1 "t" 2 "t+1" 3 "t+2", labsize(vlarge)   ) ylabel(, labsize(medlarge)) ciopts(recast(rcap) lcolor(gs6) lwidth(*2)) legend(off) msize(vlarge) title(Patents (linear), size(huge)) graphregion( margin(vsmall))
eststo clear
foreach t of numlist 1 2 3   {
			eststo time`t': qui reghdfe ln_pat_`t'_w award i.award#c.rank  i.award#c.rank#c.rank ln_pat_tm1_w if phase_smei==2, a(competition) cluster(competition) 
			local patent2 `patent2' time`t' ||
			local labels `labels' `t'
}
coefplot `patent2'  , name(patent2) keep(award ) vertical  format(%4.2f) bycoefs bylabels(`labels') xlabel(1 "t" 2 "t+1" 3 "t+2", labsize(vlarge)  ) ylabel(, labsize(medlarge)) ciopts(recast(rcap) lcolor(gs6) lwidth(*2)) legend(off) msize(vlarge) title(Patents (quadratic), size(huge)) graphregion( margin(vsmall))

graph combine patent1 patent2   , col(2) xsize(12) ysize(6) ycommon
graph export $appendix/6_Time_PAT2.png, replace width(1000)

* Investment

eststo clear
foreach t of numlist 1 2 3   {
			eststo time`t': qui reghdfe investment_`t'_w award i.award#c.rank   fixed_assets_pre_w if phase_smei==2 & inrange(rank, -10,10), a(competition) cluster(competition) 
			local 0000alltime `0000alltime' time`t' ||
			local labels `labels' `t'
}
coefplot `0000alltime' , name(investment1) keep(award ) vertical  format(%4.2f) bycoefs bylabels(`labels') xlabel(1 "t" 2 "t+1" 3 "t+2", labsize(vlarge)) ylabel(, labsize(medlarge)) ciopts(recast(rcap) lcolor(gs6) lwidth(*2)) legend(off)   msize(vlarge) title(Investment (linear), size(huge)) graphregion( margin(vsmall))
eststo clear
foreach t of numlist 1 2 3   {
			eststo time`t': qui reghdfe investment_`t'_w award i.award#c.rank i.award#c.rank#c.rank  fixed_assets_pre_w if phase_smei==2 & inrange(rank, -10,10), a(competition) cluster(competition) 
			local 000alltime `000alltime' time`t' ||
			local labels `labels' `t'
}
coefplot `000alltime' , name(investment2) keep(award ) vertical  format(%4.2f) bycoefs bylabels(`labels') xlabel(1 "t" 2 "t+1" 3 "t+2", labsize(vlarge)) ylabel(, labsize(medlarge)) ciopts(recast(rcap) lcolor(gs6) lwidth(*2)) legend(off) msize(vlarge)   title(Investment (quadratic), size(huge)) graphregion( margin(vsmall))

graph combine investment1 investment2   , col(2) xsize(12) ysize(6) ycommon
graph export $appendix/6_Time_INV.png, replace width(1000)

* Revenues
eststo clear
foreach t of numlist 1 2 3   {
			eststo time`t': qui reghdfe revenues_post`t'_w award i.award#c.rank   revenues_pre_w if phase_smei==2 & inrange(rank, -10,10), a(competition) cluster(competition) 
			local 1000alltime `1000alltime' time`t' ||
			local labels `labels' `t'
}
coefplot `1000alltime' , name(revenues1) keep(award ) vertical  format(%4.2f) bycoefs bylabels(`labels') xlabel(1 "t" 2 "t+1" 3 "t+2", labsize(vlarge)) ylabel(, labsize(medlarge)) ciopts(recast(rcap) lcolor(gs6) lwidth(*2)) legend(off)   msize(vlarge) title(Revenues (linear), size(huge)) graphregion( margin(vsmall))
eststo clear
foreach t of numlist 1 2 3   {
			eststo time`t': qui reghdfe revenues_post`t'_w award i.award#c.rank i.award#c.rank#c.rank  revenues_pre_w if phase_smei==2 & inrange(rank, -10,10), a(competition) cluster(competition) 
			local 100alltime `100alltime' time`t' ||
			local labels `labels' `t'
}
coefplot `100alltime' , name(revenues2) keep(award ) vertical  format(%4.2f) bycoefs bylabels(`labels') xlabel(1 "t" 2 "t+1" 3 "t+2", labsize(vlarge)) ylabel(, labsize(medlarge)) ciopts(recast(rcap) lcolor(gs6) lwidth(*2)) legend(off) msize(vlarge)   title(Revenues (quadratic), size(huge)) graphregion( margin(vsmall))

graph combine revenues1 revenues2   , col(2) xsize(12) ysize(6) ycommon
graph export $appendix/6_Time_REV.png, replace width(1000)

* Employment
eststo clear
foreach t of numlist 1 2 3   {
			eststo time`t': qui reghdfe employees_post`t'_w award i.award#c.rank  employees_pre_w if phase_smei==2 & inrange(rank, -10,10), a(competition) cluster(competition) 
			local 2000alltime `2000alltime' time`t' ||
			local labels `labels' `t'
}
coefplot `2000alltime' , name(employees1) keep(award ) vertical  format(%4.2f) bycoefs bylabels(`labels') xlabel(1 "t" 2 "t+1" 3 "t+2", labsize(vlarge)) ylabel(, labsize(medlarge)) ciopts(recast(rcap) lcolor(gs6) lwidth(*2))  legend(off)  msize(vlarge)  title(Employees (linear), size(huge)) graphregion( margin(vsmall))
eststo clear
foreach t of numlist 1 2 3   {
			eststo time`t': qui reghdfe employees_post`t'_w award i.award#c.rank i.award#c.rank#c.rank employees_pre_w if phase_smei==2 & inrange(rank, -10,10), a(competition) cluster(competition) 
			local 200alltime `200alltime' time`t' ||
			local labels `labels' `t'
}
coefplot `200alltime' , name(employees2) keep(award ) vertical  format(%4.2f) bycoefs bylabels(`labels') xlabel(1 "t" 2 "t+1" 3 "t+2", labsize(vlarge)) ylabel(, labsize(medlarge)) ciopts(recast(rcap) lcolor(gs6) lwidth(*2))  legend(off) msize(vlarge)   title(Employees (quadratic), size(huge)) graphregion( margin(vsmall))

graph combine employees1 employees2   , col(2) xsize(12) ysize(6) ycommon
graph export $appendix/6_Time_EMP.png, replace width(1000)


* Assets
eststo clear
foreach t of numlist 1 2 3   {
			eststo time`t': qui reghdfe assets_post`t'_w award i.award#c.rank  assets_pre_w if phase_smei==2 & inrange(rank, -10,10), a(competition) cluster(competition) 
			local 3000alltime `3000alltime' time`t' ||
			local labels `labels' `t'
}
coefplot `3000alltime' , name(assets1) keep(award ) vertical  format(%4.2f) bycoefs bylabels(`labels') xlabel(1 "t" 2 "t+1" 3 "t+2", labsize(vlarge)) ylabel(, labsize(medlarge)) ciopts(recast(rcap) lcolor(gs6) lwidth(*2)) legend(off) msize(vlarge)  title(Assets (linear), size(huge)) graphregion( margin(vsmall))
eststo clear
foreach t of numlist 1 2 3   {
			eststo time`t': qui reghdfe assets_post`t'_w award i.award#c.rank i.award#c.rank#c.rank assets_pre_w if phase_smei==2 & inrange(rank, -10,10), a(competition) cluster(competition) 
			local 300alltime `300alltime' time`t' ||
			local labels `labels' `t'
}
coefplot `300alltime' , name(assets2) keep(award ) vertical  format(%4.2f) bycoefs bylabels(`labels') xlabel(1 "t" 2 "t+1" 3 "t+2", labsize(vlarge)) ylabel(, labsize(medlarge)) ciopts(recast(rcap) lcolor(gs6) lwidth(*2)) legend(off) msize(vlarge)  title(Assets (quadratic), size(huge)) graphregion( margin(vsmall))

graph combine assets1 assets2   , col(2) xsize(12) ysize(6) ycommon
graph export $appendix/6_Time_ASS.png, replace width(1000)

graph combine patent1 patent2 pe1 pe2   , col(2) xsize(6) ysize(12) 
graph export $appendix/Figure_B1.png, replace width(1000)

graph combine investment1 investment2 assets1 assets2 employees1 employees2 revenues1 revenues2  , col(2) xsize(6) ysize(12) 
graph export $appendix/Figure_B2.png, replace width(1000)


erase scheme-newscheme.scheme




/////////////// Appendix C




/// Tables C1 to C5: Heterogeneous effects

use $data_path/DATA_ALL_FINAL.dta, clear

* compute dep vars in log levels
gen assets_post = ln(totalassets_tp1)
gen revenues_post = ln(opturnover_tp1)
gen employees_post = ln(numberofemployees_tp1)

foreach var of varlist assets_post revenues_post employees_post  {
		winsor2 `var', cuts(2 98) suff(_w)
}


* dependent var, pre-treatment var
local dvar1 ln_citw_patents_post_w  ln_citw_patents_pre_w
local dvar2 pe_post  pe_pre
local dvar3 investment_post_w  fixed_assets_pre_w
local dvar4 assets_post_w  assets_pre_w
local dvar5 employees_post_w  employees_pre_w
local dvar6 revenues_post_w  revenues_pre_w
local dvar7 exit3 

/// Table C1: Heterogeneous effects across firm-level proxies of financial constraints 

est clear
forv d=1/7 {
             eststo: qui reghdfe `dvar`d'' i.award##i.age_median $linear    if phase_smei==2, a(competition) cluster(competition)
}
esttab est* using $appendix/Table_C1.txt, replace varwidth(30) star(* 0.10 ** 0.05 *** 0.01 ) b(3) se(3) stats(N  r2, fmt(0 2) labels(N "R-squared")) keep(1.award 2.age_median 1.award#2.age_median) coeflabels(1.award "Grant" 2.age_median "Age $>$ p50" 1.award#2.age_median "Grant $\times$ Age $>$ p50") indicate( "Rank $\times$ Award=*.award#c.rank")
esttab est* using $appendix/Table_C1.tex, replace varwidth(30) star(* 0.10 ** 0.05 *** 0.01 ) b(3) se(3) stats(N  r2, fmt(0 2) labels(N "R-squared")) keep(1.award 2.age_median 1.award#2.age_median) coeflabels(1.award "Grant" 2.age_median "Age $>$ p50" 1.award#2.age_median "Grant $\times$ Age $>$ p50") indicate( "Rank $\times$ Award=*.award#c.rank") prehead(\begin{table}[htbp]\centering \def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi} \caption{Heterogeneous effects across firm-level proxies of financial constraints (Phase II)} \begin{tabular}{l*{9}{c}} \toprule) postfoot("") booktabs nonotes 

est clear
forv d=1/7 {
             eststo: qui reghdfe `dvar`d'' i.award##i.size_median $linear    if phase_smei==2, a(competition) cluster(competition)
}
esttab est* using $appendix/Table_C1.txt, append varwidth(30) star(* 0.10 ** 0.05 *** 0.01 ) b(3) se(3) stats(N  r2, fmt(0 2) labels(N "R-squared")) keep(1.award 2.size_median 1.award#2.size_median) coeflabels(1.award "Grant" 2.size_median "Size $>$ p50" 1.award#2.size_median "Grant $\times$ Size $>$ p50") indicate( "Rank $\times$ Award=*.award#c.rank") 
esttab est* using $appendix/Table_C1.tex, append varwidth(30) star(* 0.10 ** 0.05 *** 0.01 ) b(3) se(3) stats(N  r2, fmt(0 2) labels(N "R-squared")) keep(1.award 2.size_median 1.award#2.size_median) coeflabels(1.award "Grant" 2.size_median "Size $>$ p50" 1.award#2.size_median "Grant $\times$ Size $>$ p50") indicate( "Rank $\times$ Award=*.award#c.rank") postfoot(\bottomrule \end{tabular}  \end{table})  prefoot(\midrule) prehead("\midrule")  booktabs 


/// Table C2: Heterogeneous effects across sector-level proxies of financial constraints 

est clear
forv d=1/7 {
             eststo: qui reghdfe `dvar`d'' i.award##i.cash_quartiles $linear    if phase_smei==2, a(competition) cluster(competition)
}
esttab est* using $appendix/Table_C2.txt, replace varwidth(30) star(* 0.10 ** 0.05 *** 0.01 ) b(3) se(3) stats(N  r2, fmt(0 2) labels(N "R-squared")) keep(1.award 2.cash_quartiles 1.award#2.cash_quartiles) coeflabels(1.award "Grant" 2.cash_quartiles "CFA $>$ p50" 1.award#2.cash_quartiles "Grant $\times$ CFA $>$ p50") indicate( "Rank $\times$ Award=*.award#c.rank")
esttab est* using $appendix/Table_C2.tex, replace varwidth(30) star(* 0.10 ** 0.05 *** 0.01 ) b(3) se(3) stats(N  r2, fmt(0 2) labels(N "R-squared")) keep(1.award 2.cash_quartiles 1.award#2.cash_quartiles) coeflabels(1.award "Grant" 2.cash_quartiles "CFA $>$ p50" 1.award#2.cash_quartiles "Grant $\times$ CFA $>$ p50") indicate( "Rank $\times$ Award=*.award#c.rank") prehead(\begin{table}[htbp]\centering \def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi} \caption{Heterogeneous effects across firm-level proxies of financial constraints (Phase II)} \begin{tabular}{l*{9}{c}} \toprule) postfoot("") booktabs nonotes 

est clear
forv d=1/7 {
             eststo: qui reghdfe `dvar`d'' i.award##i.tang_quartiles $linear    if phase_smei==2, a(competition) cluster(competition)
}
esttab est* using $appendix/Table_C2.txt, append varwidth(30) star(* 0.10 ** 0.05 *** 0.01 ) b(3) se(3) stats(N  r2, fmt(0 2) labels(N "R-squared")) keep(1.award 2.tang_quartiles 1.award#2.tang_quartiles) coeflabels(1.award "Grant" 2.tang_quartiles "TNG $>$ p50" 1.award#2.tang_quartiles "Grant $\times$ TNG $>$ p50") indicate( "Rank $\times$ Award=*.award#c.rank")
esttab est* using $appendix/Table_C2.tex, append varwidth(30) star(* 0.10 ** 0.05 *** 0.01 ) b(3) se(3) stats(N  r2, fmt(0 2) labels(N "R-squared")) keep(1.award 2.tang_quartiles 1.award#2.tang_quartiles) coeflabels(1.award "Grant" 2.tang_quartiles "TNG $>$ p50" 1.award#2.tang_quartiles "Grant $\times$ TNG $>$ p50") indicate( "Rank $\times$ Award=*.award#c.rank") postfoot(\bottomrule \end{tabular}  \end{table})  prefoot(\midrule) prehead("\midrule")  booktabs

/// Table C3: Heterogeneous effects across country-level economic and financial development 

est clear
forv d=1/7 {
             eststo: qui reghdfe `dvar`d'' i.award##i.gdp_median $linear    if phase_smei==2, a(competition) cluster(competition)
}
esttab est* using $appendix/Table_C3.txt, replace varwidth(30) star(* 0.10 ** 0.05 *** 0.01 ) b(3) se(3) stats(N r2, fmt(0 2) labels(N "R-squared")) keep(1.award 2.gdp_median 1.award#2.gdp_median) coeflabels(1.award "Grant" 2.gdp_median "GDP $>$ p50" 1.award#2.gdp_median "Grant $\times$s GDP $>$ p50") indicate( "Rank $\times$ Award=*.award#c.rank")
esttab est* using $appendix/Table_C3.tex, replace varwidth(30) star(* 0.10 ** 0.05 *** 0.01 ) b(3) se(3) stats(N r2, fmt(0 2) labels(N "R-squared")) keep(1.award 2.gdp_median 1.award#2.gdp_median) coeflabels(1.award "Grant" 2.gdp_median "GDP $>$ p50" 1.award#2.gdp_median "Grant $\times$s GDP $>$ p50") indicate( "Rank $\times$ Award=*.award#c.rank") prehead(\begin{table}[htbp]\centering \def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi} \caption{Heterogeneous effects across firm-level proxies of financial constraints (Phase II)} \begin{tabular}{l*{9}{c}} \toprule) postfoot("") booktabs nonotes 

est clear
forv d=1/7 {
             eststo: qui reghdfe `dvar`d'' i.award##i.findev_median $linear    if phase_smei==2, a(competition) cluster(competition)
}
esttab est* using $appendix/Table_C3.txt, append varwidth(30) star(* 0.10 ** 0.05 *** 0.01 ) b(3) se(3) stats(N r2, fmt(0 2) labels(N "R-squared"))  keep(1.award 2.findev_median 1.award#2.findev_median) coeflabels(1.award "Grant" 2.findev_median "FIN $>$ p50" 1.award#2.findev_median "Grant $\times$ FIN $>$ p50") indicate( "Rank $\times$ Award=*.award#c.rank")
esttab est* using $appendix/Table_C3.tex, append varwidth(30) star(* 0.10 ** 0.05 *** 0.01 ) b(3) se(3) stats(N r2, fmt(0 2) labels(N "R-squared"))  keep(1.award 2.findev_median 1.award#2.findev_median) coeflabels(1.award "Grant" 2.findev_median "FIN $>$ p50" 1.award#2.findev_median "Grant $\times$ FIN $>$ p50") indicate( "Rank $\times$ Award=*.award#c.rank") postfoot(\bottomrule \end{tabular}  \end{table})  prefoot(\midrule) prehead("\midrule")  booktabs


/// Table C4: Heterogeneous effects across regional GDP 

est clear
forv d=1/7 {
             eststo: qui reghdfe `dvar`d'' i.award##i.reg_gdp_median $linear    if phase_smei==2, a(competition) cluster(competition)
}
esttab est* using $appendix/Table_C4.txt, replace varwidth(30) star(* 0.10 ** 0.05 *** 0.01 ) b(3) se(3) stats(N r2, fmt(0 2) labels(N "R-squared"))  keep(1.award 2.reg_gdp_median 1.award#2.reg_gdp_median) coeflabels(1.award "Grant" 2.reg_gdp_median "REG $>$ p50" 1.award#2.reg_gdp_median "Grant $\times$ REG $>$ p50") indicate( "Rank $\times$ Award=*.award#c.rank")
esttab est* using $appendix/Table_C4.tex, replace varwidth(30) star(* 0.10 ** 0.05 *** 0.01 ) b(3) se(3) stats(N r2, fmt(0 2) labels(N "R-squared"))  keep(1.award 2.reg_gdp_median 1.award#2.reg_gdp_median) coeflabels(1.award "Grant" 2.reg_gdp_median "REG $>$ p50" 1.award#2.reg_gdp_median "Grant $\times$ REG $>$ p50") indicate( "Rank $\times$ Award=*.award#c.rank") postfoot(\bottomrule \end{tabular}  \end{table})  prefoot(\midrule) prehead("\midrule")  booktabs


/// Table C5: Heterogeneous effects across patenting intensity

gen pat_intense = 0 if nacerev2corecode4digits!=.
foreach i in 610 620 729 910 1041 1083 1089 1200 1394 1395 1399 1411 1712 1722 1729 2011 2012 2013 2014 2016 2020 2030 2041 2042 2051 2052 2053 2059 2060 2110 2120 ///
2211 2219 2221 2222 2223 2229 2311 2311 2314 2319 2343 2344 2362 2391 2399 2434 2441 2442 2445 2446 2530 2540 2550 2571 2572 2573 2591 2592 2593 2594 2599 2611 2612 2620 ///
2630 2640 2651 2652 2660 2670 2680 2711 2712 2720 2731 2732 2733 2740 2751 2790 2811 2812 2813 2814 2815 2821 2822 2823 2824 2825 2829 2830 2841 2849 2891 2892 2893 2894 ///
2895 2896 2899 2910 2920 2931 2932 3020 3030 3040 3091 3092 3099 3103 3230 3240 3250 3291 3299 3319 3320 4531 4612 4614 4615 4636 4643 4646 4662 4669 4675 5829 6120 6130 ///
6190 7112 7120 7211 7219 7220 7490 7740 {
	replace pat_intense = 1 if nacerev2corecode4digits==`i'
}

/// Table C5: Heterogeneous effects across sector-level patenting intensity

est clear
forv d=1/7 {
             eststo: qui reghdfe `dvar`d'' i.award##i.pat_intense $linear    if phase_smei==2, a(competition) cluster(competition)
}
esttab est* ,  star(* 0.10 ** 0.05 *** 0.01 ) b(3) se(3) keep(1.award 1.pat_intense 1.award#1.pat_intense) stat(N r2 aic, fmt(0 2))
esttab est* using $appendix/Table_C5.txt, replace varwidth(30) star(* 0.10 ** 0.05 *** 0.01 ) b(3) se(3) stats(N  r2, fmt(0 2) labels(N "R-squared")) keep(1.award 1.pat_intense 1.award#1.pat_intense) coeflabels(1.award "Grant" 1.pat_intense "PAT" 1.award#1.pat_intense "Grant $\times$ PAT") indicate( "Rank $\times$ Award=*.award#c.rank")
esttab est* using $appendix/Table_C5.tex, replace varwidth(30) star(* 0.10 ** 0.05 *** 0.01 ) b(3) se(3) stats(N  r2, fmt(0 2) labels(N "R-squared")) keep(1.award 1.pat_intense 1.award#1.pat_intense) coeflabels(1.award "Grant" 1.pat_intense "PAT" 1.award#1.pat_intense "Grant $\times$ PAT") indicate( "Rank $\times$ Award=*.award#c.rank") prehead(\begin{table}[htbp]\centering \def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi} \caption{Heterogeneous effects across firm-level proxies of financial constraints (Phase II)} \begin{tabular}{l*{9}{c}} \toprule) postfoot("") booktabs nonotes 




/////////////// Appendix D



// Table D1: Grant-winning firms vs SOE recipient firms

use $data_path/DATA_ALL_FINAL.dta, clear

* compute dep vars in log levels
gen assets_post = ln(totalassets_tp1)
gen revenues_post = ln(opturnover_tp1)
gen employees_post = ln(numberofemployees_tp1)

foreach var of varlist assets_post revenues_post employees_post  {
		winsor2 `var', cuts(2 98) suff(_w)
}


* controls for polinomyal orders on both sides of the threshold
local linear    c.rank#i.award
local quadratic c.rank#i.award c.rank#c.rank#i.award

eststo clear
eststo: qui reghdfe ln_citw_patents_post_w award `linear'  ln_citw_patents_pre_w if phase_smei==2  , a(competition) cluster(competition) 
eststo: qui reghdfe ln_citw_patents_post_w award `linear'  ln_citw_patents_pre_w if phase_smei==2  & (seal==1 | award==1), a(competition) cluster(competition) 
eststo: qui reghdfe ln_citw_patents_post_w award `linear'  ln_citw_patents_pre_w if phase_smei==2  & inrange(rank, -10,10), a(competition) cluster(competition) 
eststo: qui reghdfe ln_citw_patents_post_w award `linear'  ln_citw_patents_pre_w if phase_smei==2  & inrange(rank, -10,10) & (seal==1 | award==1), a(competition) cluster(competition) 

eststo: qui reghdfe pe_post award `linear'  pe_pre if phase_smei==2   & ln_citw_patents_post_w!=., a(competition) cluster(competition) 
eststo: qui reghdfe pe_post award `linear'  pe_pre if phase_smei==2   & ln_citw_patents_post_w!=. & (seal==1 | award==1), a(competition) cluster(competition) 
eststo: qui reghdfe pe_post award `linear'  pe_pre if phase_smei==2  & inrange(rank, -10,10) & ln_citw_patents_post_w!=., a(competition) cluster(competition) 
eststo: qui reghdfe pe_post award `linear'  pe_pre if phase_smei==2  & inrange(rank, -10,10) & ln_citw_patents_post_w!=. & (seal==1 | award==1), a(competition) cluster(competition) 
esttab est* using $appendix/Table_D1.tex, replace star(* 0.10 ** 0.05 *** 0.01 ) b(3) se(3) stats(N  N_clust r2, fmt(0 0 2) labels(N "\# competitions" "R-squared" )) keep(award award) coeflabels(award "Grant" ) mtitles(All All 10 10 All All 10 10)   prehead(\begin{table}[htbp]\centering \def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi} \caption{Certification vs Funding - Test 1} \begin{tabular}{l*{9}{c}} \toprule) postfoot("") posthead(\midrule ) booktabs nonotes indicate( "Rank $\times$ Award=*.award*#c.rank"  `r(indicate_fe)') varwidth(25)
esttab est* using $appendix/Table_D1.txt, replace star(* 0.10 ** 0.05 *** 0.01 ) b(3) se(3) stats(N  N_clust r2, fmt(0 0 2) labels(N "\# competitions" "R-squared" )) keep(award award) coeflabels(award "Grant" ) mtitles(All All 10 10 All All 10 10)  nonotes indicate( "Rank $\times$ Award=*.award*#c.rank"  `r(indicate_fe)') varwidth(25)


eststo clear
foreach var in  "assets" "employees" "revenues"  {
eststo est_`var'_3:  qui reghdfe `var'_post_w  award `linear'  `var'_pre_w  if phase_smei==2  , a(competition) cluster(competition)
eststo est_`var'_4:  qui reghdfe `var'_post_w  award `linear'  `var'_pre_w  if phase_smei==2  & (seal==1 | award==1), a(competition) cluster(competition)
eststo est_`var'_7:  qui reghdfe `var'_post_w  award `linear'  `var'_pre_w  if phase_smei==2  & inrange(rank, -10,10), a(competition) cluster(competition)
eststo est_`var'_8:  qui reghdfe `var'_post_w  award `linear'  `var'_pre_w  if phase_smei==2  & inrange(rank, -10,10) & (seal==1 | award==1), a(competition) cluster(competition)
}
esttab  est_assets_* est_employees_*   using $appendix/Table_A20.tex, append star(* 0.10 ** 0.05 *** 0.01 ) b(3) se(3) stats(N N_clust r2, fmt(0 0 2) labels(N "\# competitions" "R-squared" )) keep(award )  coeflabels(award "Grant" ) mtitles(All All 10 10 All All 10 10) postfoot("") prefoot(\midrule) prehead("\midrule") posthead(\midrule )  booktabs indicate( "Rank $\times$ Award=*.award*#c.rank" `r(indicate_fe)') varwidth(25)
esttab  est_assets_* est_employees_*   using $appendix/Table_A20.txt, append star(* 0.10 ** 0.05 *** 0.01 ) b(3) se(3) stats(N N_clust r2, fmt(0 0 2) labels(N "\# competitions" "R-squared" )) keep(award )  coeflabels(award "Grant" ) mtitles(All All 10 10 All All 10 10) postfoot("") prefoot(\midrule) prehead("\midrule") posthead(\midrule )  booktabs indicate( "Rank $\times$ Award=*.award*#c.rank" `r(indicate_fe)') varwidth(25)


eststo est_exit_3: qui reghdfe exit3 award `linear'   if phase_smei==2   , a(competition) cluster(competition) 
eststo est_exit_4: qui reghdfe exit3 award `linear'   if phase_smei==2   & (seal==1 | award==1), a(competition) cluster(competition) 
eststo est_exit_1: qui reghdfe exit3 award `linear'   if phase_smei==2  & inrange(rank, -10,10) , a(competition) cluster(competition) 
eststo est_exit_2: qui reghdfe exit3 award `linear'   if phase_smei==2  & inrange(rank, -10,10) & (seal==1 | award==1) , a(competition) cluster(competition) 
esttab est_revenues_* est_exit_* using $appendix/Table_D1.tex, append star(* 0.10 ** 0.05 *** 0.01 ) b(3) se(3) stats(N N_clust r2, fmt(0 0 2) labels(N "\# competitions" "R-squared" )) keep(award )  coeflabels(award "Grant" ) mtitles(All All 10 10 All All 10 10) postfoot(\bottomrule \end{tabular}  \end{table})  prefoot(\midrule) prehead("\midrule") posthead(\midrule ) booktabs indicate( "Rank $\times$ Award=*.award*#c.rank" `r(indicate_fe)') varwidth(25)
esttab est_revenues_* est_exit_* using $appendix/Table_D1.txt, append star(* 0.10 ** 0.05 *** 0.01 ) b(3) se(3) stats(N N_clust r2, fmt(0 0 2) labels(N "\# competitions" "R-squared" )) keep(award )  coeflabels(award "Grant" ) mtitles(All All 10 10 All All 10 10) indicate( "Rank $\times$ Grant=*.award*#c.rank" `r(indicate_fe)') varwidth(25)




// Table D2: The effects on patents for firms (not) receiving private equity

use $data_path/DATA_ALL_FINAL.dta, clear

* controls for polinomyal orders on both sides of the threshold
local linear    c.rank#i.award
local quadratic c.rank#i.award c.rank#c.rank#i.award

* regression loops reproducing Table 15: The effects on patents for firms (not) receiving private equity
eststo clear
foreach var in "ln_citw_patents"  {
eststo :  qui reghdfe `var'_post_w award `linear' `var'_pre_w  if phase_smei==2  & pe_post==1  , a(competition) cluster(competition)
eststo :  qui reghdfe `var'_post_w award `linear' `var'_pre_w  if phase_smei==2  & pe_post==0, a(competition) cluster(competition)
eststo :  qui reghdfe `var'_post_w award `quadratic' `var'_pre_w  if phase_smei==2  & pe_post==1  , a(competition) cluster(competition)
eststo :  qui reghdfe `var'_post_w award `quadratic' `var'_pre_w  if phase_smei==2  & pe_post==0, a(competition) cluster(competition)
}
esttab est* using $appendix/Table_D2.txt, replace star(* 0.10 ** 0.05 *** 0.01 ) b(3) se(3) stats(N N_clust r2, fmt(0 0 2) labels(N "\# competitions" "R-squared" )) keep(award )  coeflabels(award "Grant" ) mtitles(All All 10 10 5 5) ///
 indicate( "Rank x Award=*.award#c.rank" "Rank2 x Award=*.award#c.rank#c.rank" `r(indicate_fe)') nonote  varwidth(25) 
esttab est* using $appendix/Table_D2.tex, replace star(* 0.10 ** 0.05 *** 0.01 ) b(3) se(3) stats(N N_clust r2, fmt(0 0 2) labels(N "\# competitions" "R-squared" )) keep(award )  coeflabels(award "Grant" ) mtitles(All All 10 10 5 5) ///
 indicate( "Rank x Award=*.award#c.rank" "Rank2 x Award=*.award#c.rank#c.rank" `r(indicate_fe)') nonote  varwidth(25) 

 
// Table D3: The effects on private equity for firms (not) patenting

use $data_path/DATA_ALL_FINAL.dta, clear

* controls for polinomyal orders on both sides of the threshold
local linear    c.rank#i.award
local quadratic c.rank#i.award c.rank#c.rank#i.award

* regression loops reproducing Table 10: The effects on private equity for firms (not) patenting
eststo clear
foreach var in "pe"  {
eststo: qui reghdfe `var'_post award `linear'  `var'_pre if phase_smei==2   & n_patents_post_old==0, a(competition) cluster(competition) 
eststo: qui reghdfe `var'_post award `linear'  `var'_pre if phase_smei==2   & n_patents_post_old>=1, a(competition) cluster(competition) 
eststo: qui reghdfe `var'_post award `quadratic'  `var'_pre if phase_smei==2   & n_patents_post_old==0, a(competition) cluster(competition) 
eststo: qui reghdfe `var'_post award `quadratic'  `var'_pre if phase_smei==2   & n_patents_post_old>=1, a(competition) cluster(competition) 
}
esttab est* using $appendix/Table_D3.txt, replace star(* 0.10 ** 0.05 *** 0.01 ) b(3) se(3) stats(N N_clust r2, fmt(0 0 2) labels(N "\# competitions" "R-squared" )) keep(award )  coeflabels(award "Grant" ) mtitles(All All 10 10 5 5) ///
 indicate( "Rank x Award=*.award#c.rank" "Rank2 x Award=*.award#c.rank#c.rank" `r(indicate_fe)') nonote  varwidth(25) 
esttab est* using $appendix/Table_D3.tex, replace star(* 0.10 ** 0.05 *** 0.01 ) b(3) se(3) stats(N N_clust r2, fmt(0 0 2) labels(N "\# competitions" "R-squared" )) keep(award )  coeflabels(award "Grant" ) mtitles(All All 10 10 5 5) ///
 indicate( "Rank x Award=*.award#c.rank" "Rank2 x Award=*.award#c.rank#c.rank" `r(indicate_fe)') nonote  varwidth(25) 




// Table D4: Sensitivity to grant size

use $data_path/DATA_ALL_FINAL.dta, clear

cap drop large
gen large = (financial_details_recommended_eu > 1292392) 

* compute dep vars in log levels
gen assets_post = ln(totalassets_tp1)
gen revenues_post = ln(opturnover_tp1)
gen employees_post = ln(numberofemployees_tp1)

foreach var of varlist assets_post revenues_post employees_post  {
		winsor2 `var', cuts(2 98) suff(_w)
}


* controls for polinomyal orders on both sides of the threshold
local linear    c.rank#i.award
local quadratic c.rank#i.award c.rank#c.rank#i.award

eststo clear
foreach var in "ln_citw_patents"   {
		eststo: qui reghdfe `var'_post_w i1.award#i1.large i1.award#i0.large $linear		`var'_pre_w  if phase_smei==2  , cluster(competition) a(competition)
		eststo: qui reghdfe `var'_post_w i1.award#i1.large i1.award#i0.large $linear		`var'_pre_w  if phase_smei==2   & inrange(rank,-10,10), cluster(competition) a(competition)
}
foreach var in "pe"   {
		eststo: qui reghdfe `var'_post i1.award#i1.large i1.award#i0.large $linear 		`var'_pre  if phase_smei==2  , cluster(competition) a(competition)
		eststo: qui reghdfe `var'_post i1.award#i1.large i1.award#i0.large $linear 		`var'_pre  if phase_smei==2   & inrange(rank,-10,10), cluster(competition) a(competition)
}
foreach var in "revenues" "employees" "assets"  {
		eststo: qui reghdfe `var'_post_w i1.award#i1.large i1.award#i0.large $linear   `var'_pre_w  if phase_smei==2  , cluster(competition) a(competition)
		eststo: qui reghdfe `var'_post_w i1.award#i1.large i1.award#i0.large $linear   `var'_pre_w  if phase_smei==2  & inrange(rank,-10,10), cluster(competition) a(competition)

}
eststo: qui reghdfe exit3 i1.award#i1.large i1.award#i0.large $linear 	     if phase_smei==2  , cluster(competition) a(competition)
eststo: qui reghdfe exit3 i1.award#i1.large i1.award#i0.large $linear  	     if phase_smei==2  & inrange(rank,-10,10), cluster(competition) a(competition)
estfe . est*, labels(competition "Competition FE")
esttab est1 est2 est3 est4 est5 est6 using $appendix/Table_D4.tex, replace star(* 0.10 ** 0.05 *** 0.01 ) b(3) se(3) stats(N N_clust r2, fmt(0 0 2) labels(N "\# competitions" "R-squared" )) keep(1.award*) coeflabels(1.award#0.large "Grant" 1.award#1.large "Award $\times$ Large" 1.award#0.large "Award $\times$ Small") mtitles(All 10 5 All 10 5)  indicate( "Rank $\times$ Award=*.award*#c.rank"  `r(indicate_fe)') nonote
esttab est7 est8 est9 est10 est11 est12 using $appendix/Table_D4.tex, append star(* 0.10 ** 0.05 *** 0.01 ) b(3) se(3) stats(N N_clust r2, fmt(0 0 2) labels(N "\# competitions" "R-squared" )) keep(1.award*) coeflabels(1.award#0.large "Grant" 1.award#1.large "Award $\times$ Large" 1.award#0.large "Award $\times$ Small") mtitles(All 10 5 All 10 5)  indicate( "Rank $\times$ Award=*.award*#c.rank"  `r(indicate_fe)') nonote
esttab est1 est2 est3 est4 est5 est6 using $appendix/Table_D4.txt, replace star(* 0.10 ** 0.05 *** 0.01 ) b(3) se(3) stats(N N_clust r2, fmt(0 0 2) labels(N "\# competitions" "R-squared" )) keep(1.award*) coeflabels(1.award#0.large "Grant" 1.award#1.large "Award $\times$ Large" 1.award#0.large "Award $\times$ Small") mtitles(All 10 5 All 10 5)  indicate( "Rank $\times$ Award=*.award*#c.rank"  `r(indicate_fe)') nonote
esttab est7 est8 est9 est10 est11 est12 using $appendix/Table_D4.txt, append star(* 0.10 ** 0.05 *** 0.01 ) b(3) se(3) stats(N N_clust r2, fmt(0 0 2) labels(N "\# competitions" "R-squared" )) keep(1.award*) coeflabels(1.award#0.large "Grant" 1.award#1.large "Award $\times$ Large" 1.award#0.large "Award $\times$ Small") mtitles(All 10 5 All 10 5)  indicate( "Rank $\times$ Award=*.award*#c.rank"  `r(indicate_fe)') nonote



// Table D5: The effects on debt over total assets

use $data_path/DATA_ALL_FINAL.dta, clear

gen debt_post = currentliabilities_tp1 + noncurrentliabilities_tp1
gen debt_pre = currentliabilities_tm1 + noncurrentliabilities_tm1
su debt_post,d
gen debt_ass_post = debt_post / totalassets_tp1
gen debt_ass_pre = debt_pre / totalassets_tm1
winsor2 debt_ass_post debt_ass_pre, cuts(2 98)

eststo clear
foreach ranks in   "i.award#c.rank" "i.award#c.rank i.award#c.rank#c.rank" "i.quintile" {
		eststo: qui reghdfe debt_ass_post_w award `ranks'  debt_ass_pre_w if phase_smei==2 , a(competition) cluster(competition) 
}
eststo: qui reghdfe debt_ass_post_w award $linear			    debt_ass_pre_w   if phase_smei==2  & inrange(rank, -10,10), cluster(competition)  a(competition)
eststo: qui reghdfe debt_ass_post_w award $quadratic  debt_ass_pre_w  if phase_smei==2  & inrange(rank, -10,10), cluster(competition)  a(competition)
eststo: qui reghdfe debt_ass_post_w award $linear			    debt_ass_pre_w   if phase_smei==2  & inrange(rank, -5,5), cluster(competition)  a(competition)
eststo: qui reghdfe debt_ass_post_w award $quadratic  debt_ass_pre_w  if phase_smei==2  & inrange(rank, -5,5), cluster(competition)  a(competition)
estfe . est*, labels(competition "Competition FE")
esttab est* using $appendix/Table_D5.tex, replace star(* 0.10 ** 0.05 *** 0.01 ) b(3) se(3) stats(N N_clust r2 bic, fmt(0 0 2) labels(N "\# competitions" "R-squared" "BIC")) coeflabels(award "Grant" rank "Rank" c.rank#c.rank "Rank$^2$" 1.award#c.rank "Rank $\times$ Award" 0.award#c.rank "Rank $\times$ NoAward" 1.award#c.rank#c.rank "Rank$^2$ $\times$ Award" 0.award#c.rank#c.rank "Rank$^2$ $\times$ NoAward")  mtitles(All All All 10 10 5 5 ) drop(_cons ) postfoot(\bottomrule \end{tabular}  \end{table})  prefoot(\midrule) prehead("\midrule") posthead(\midrule \textbf{Panel B: Phase II}\\) booktabs indicate( "Rank $\times$ Award=*award#c.rank" "Rank^{2} $\times$ Award=*.award#c.rank#c.rank" "Rank quintiles=*.quintile"  "Pre-award= debt_ass_pre_w" `r(indicate_fe)') varwidth(25)
esttab est* using $appendix/Table_D5.txt, replace star(* 0.10 ** 0.05 *** 0.01 ) b(3) se(3) stats(N N_clust r2 bic, fmt(0 0 2) labels(N "\# competitions" "R-squared" "BIC")) coeflabels(award "Grant" rank "Rank" c.rank#c.rank "Rank$^2$" 1.award#c.rank "Rank $\times$ Award" 0.award#c.rank "Rank $\times$ NoAward" 1.award#c.rank#c.rank "Rank$^2$ $\times$ Award" 0.award#c.rank#c.rank "Rank$^2$ $\times$ NoAward")  mtitles(All All All 10 10 5 5 ) drop(_cons *.competition) indicate( "Rank $\times$ Award=*award#c.rank" "Rank^{2} $\times$ Award=*.award#c.rank#c.rank" "Rank quintiles=*.quintile"  "Pre-award= debt_ass_pre_w" `r(indicate_fe)') varwidth(25)



// Table D6: The effects on long-term debt over total debt

cap drop ltdebttotal_post2
gen ltdebttotal_post2 = longtermdebt_tp1 / debt_post
winsor2 ltdebttotal_post2, cuts(2 98)

eststo clear
foreach ranks in   "i.award#c.rank" "i.award#c.rank i.award#c.rank#c.rank" "i.quintile" {
		eststo: qui reghdfe ltdebttotal_post2_w award `ranks'   if phase_smei==2 , a(competition) cluster(competition) 
}
eststo: qui reghdfe ltdebttotal_post2_w award $linear			       if phase_smei==2  & inrange(rank, -10,10), cluster(competition)  a(competition)
eststo: qui reghdfe ltdebttotal_post2_w award $quadratic    if phase_smei==2  & inrange(rank, -10,10), cluster(competition)  a(competition)
eststo: qui reghdfe ltdebttotal_post2_w award $linear				       if phase_smei==2  & inrange(rank, -5,5), cluster(competition)  a(competition)
eststo: qui reghdfe ltdebttotal_post2_w award $quadratic    if phase_smei==2  & inrange(rank, -5,5), cluster(competition)  a(competition)
estfe . est*, labels(competition "Competition FE")
esttab est* using $appendix/Table_D6.tex, replace star(* 0.10 ** 0.05 *** 0.01 ) b(3) se(3) stats(N N_clust r2 bic, fmt(0 0 2) labels(N "\# competitions" "R-squared" "BIC")) coeflabels(award "Grant" rank "Rank" c.rank#c.rank "Rank$^2$" 1.award#c.rank "Rank $\times$ Award" 0.award#c.rank "Rank $\times$ NoAward" 1.award#c.rank#c.rank "Rank$^2$ $\times$ Award" 0.award#c.rank#c.rank "Rank$^2$ $\times$ NoAward")  mtitles(All All All 10 10 5 5 ) drop(_cons ) postfoot(\bottomrule \end{tabular}  \end{table})  prefoot(\midrule) prehead("\midrule") posthead(\midrule \textbf{Panel B: Phase II}\\) booktabs indicate( "Rank $\times$ Award=*award#c.rank" "Rank^{2} $\times$ Award=*.award#c.rank#c.rank" "Rank quintiles=*.quintile"  "Pre-award= " `r(indicate_fe)') varwidth(25)
esttab est* using $appendix/Table_D6.txt, replace star(* 0.10 ** 0.05 *** 0.01 ) b(3) se(3) stats(N N_clust r2 bic, fmt(0 0 2) labels(N "\# competitions" "R-squared" "BIC")) coeflabels(award "Grant" rank "Rank" c.rank#c.rank "Rank$^2$" 1.award#c.rank "Rank $\times$ Award" 0.award#c.rank "Rank $\times$ NoAward" 1.award#c.rank#c.rank "Rank$^2$ $\times$ Award" 0.award#c.rank#c.rank "Rank$^2$ $\times$ NoAward")  mtitles(All All All 10 10 5 5 ) drop(_cons *.competition) indicate( "Rank $\times$ Award=*award#c.rank" "Rank^{2} $\times$ Award=*.award#c.rank#c.rank" "Rank quintiles=*.quintile"  "Pre-award= " `r(indicate_fe)') varwidth(25)



// Table D6: see Table_7.do



////////////////// Appendix G



// Table G1: Alternative fixed effects structure 

use $data_path/DATA_ALL_FINAL.dta, clear

* compute dep vars in log levels
gen assets_post = ln(totalassets_tp1)
gen revenues_post = ln(opturnover_tp1)
gen employees_post = ln(numberofemployees_tp1)

foreach var of varlist assets_post revenues_post employees_post  {
		winsor2 `var', cuts(2 98) suff(_w)
}


eststo clear
foreach var in "ln_citw_patents"  {

eststo:  qui reghdfe `var'_post_w award c.rank#i.award     `var'_pre_w  if phase_smei==2, a(competition) cluster(competition)
eststo:  qui reghdfe `var'_post_w award c.rank#i.award     `var'_pre_w  if phase_smei==2, a(competition coordinator_country nace2 year_of_incorporation d_firm_appl_multi_times_ph2 d_win_ph1_apply_ph2) cluster(competition)
eststo:  qui reghdfe `var'_post_w award c.rank#i.award     `var'_pre_w  if phase_smei==2  & inrange(rank, -10,10), a(competition) cluster(competition)
eststo:  qui reghdfe `var'_post_w award c.rank#i.award     `var'_pre_w  if phase_smei==2  & inrange(rank, -10,10), a(competition coordinator_country d_firm_appl_multi_times_ph2 d_win_ph1_apply_ph2) cluster(competition)

eststo:  qui reghdfe `var'_post_w award c.rank#i.award     `var'_pre_w  if phase_smei==2  & inrange(rank, -5,5), a(competition) cluster(competition)
eststo:  qui reghdfe `var'_post_w award c.rank#i.award     `var'_pre_w  if phase_smei==2  & inrange(rank, -5,5), a(competition coordinator_country nace1 d_firm_appl_multi_times_ph2 d_win_ph1_apply_ph2) cluster(competition)

}
esttab est* using $appendix/Table_G1.tex, replace star(* 0.10 ** 0.05 *** 0.01 ) b(3) se(3) stats(N N_hdfe r2, fmt(0 0 2) labels(N "\# FE"  "R-squared" )) keep(award award) coeflabels(award "Grant" ) mtitles(All All 10 10 All All 10 10)   prehead(\begin{table}[htbp]\centering \def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi} \caption{Alternative fixed effect structure} \begin{tabular}{l*{9}{c}} \toprule) postfoot("") posthead(\midrule ) booktabs nonotes  varwidth(25)
esttab est* using $appendix/Table_G1.txt, replace star(* 0.10 ** 0.05 *** 0.01 ) b(3) se(3) stats(N N_hdfe r2, fmt(0 0 2) labels(N "\# FE"  "R-squared" )) keep(award award) coeflabels(award "Grant" ) mtitles(All All 10 10 All All 10 10)  nonotes  varwidth(25)

eststo clear
foreach var in "pe"  {

eststo:  qui reghdfe `var'_post award c.rank#i.award     `var'_pre  if phase_smei==2  , a(competition) cluster(competition)
eststo:  qui reghdfe `var'_post award c.rank#i.award     `var'_pre  if phase_smei==2  , a(competition coordinator_country nace2 year_of_incorporation d_firm_appl_multi_times_ph2 d_win_ph1_apply_ph2) cluster(competition)
eststo:  qui reghdfe `var'_post award c.rank#i.award	 `var'_pre  if phase_smei==2  & inrange(rank, -10,10)  , a(competition) cluster(competition)
eststo:  qui reghdfe `var'_post award c.rank#i.award     `var'_pre  if phase_smei==2  & inrange(rank, -10,10)  , a(competition coordinator_country nace2 year_of_incorporation d_firm_appl_multi_times_ph2 d_win_ph1_apply_ph2) cluster(competition)

eststo:  qui reghdfe `var'_post award c.rank#i.award	 `var'_pre  if phase_smei==2  & inrange(rank, -5,5)  , a(competition) cluster(competition)
eststo:  qui reghdfe `var'_post award c.rank#i.award     `var'_pre  if phase_smei==2  & inrange(rank, -5,5)  , a(competition coordinator_country nace2 year_of_incorporation d_firm_appl_multi_times_ph2 d_win_ph1_apply_ph2) cluster(competition)

}
estfe . est*, labels(nace1 "Sector FE" year_of_incorporation "Cohort FE"  coordinator_country "Country" competition "Competition FE")
esttab est*   using $appendix/Table_G1.tex, append star(* 0.10 ** 0.05 *** 0.01 ) b(3) se(3) stats(N N_hdfe r2, fmt(0 0 2) labels(N "\# FE"  "R-squared"  )) keep(award )  coeflabels(award "Grant" ) mtitles(All All 10 10 All All 10 10) postfoot("") prefoot(\midrule) prehead("\midrule") posthead(\midrule )  booktabs  varwidth(25)
estfe . est*, labels(nace1 "Sector FE" year_of_incorporation "Cohort FE"  coordinator_country "Country" competition "Competition FE")
esttab est*   using $appendix/Table_G1.txt, append star(* 0.10 ** 0.05 *** 0.01 ) b(3) se(3) stats(N N_hdfe r2, fmt(0 0 2) labels(N "\# FE"  "R-squared"  )) keep(award )  coeflabels(award "Grant" ) mtitles(All All 10 10 All All 10 10) varwidth(25)

eststo clear
foreach var in "investment"  {

eststo:  qui reghdfe `var'_post_w award c.rank#i.award     fixed_assets_pre_w  if phase_smei==2  , a(competition) cluster(competition)
eststo:  qui reghdfe `var'_post_w award c.rank#i.award     fixed_assets_pre_w  if phase_smei==2  , a(competition coordinator_country nace2 year_of_incorporation d_firm_appl_multi_times_ph2 d_win_ph1_apply_ph2) cluster(competition)
eststo:  qui reghdfe `var'_post_w award c.rank#i.award	 fixed_assets_pre_w  if phase_smei==2  & inrange(rank, -10,10)  , a(competition) cluster(competition)
eststo:  qui reghdfe `var'_post_w award c.rank#i.award     fixed_assets_pre_w  if phase_smei==2  & inrange(rank, -10,10)  , a(competition coordinator_country nace2 year_of_incorporation d_firm_appl_multi_times_ph2 d_win_ph1_apply_ph2) cluster(competition)

eststo:  qui reghdfe `var'_post_w award c.rank#i.award	   fixed_assets_pre_w  if phase_smei==2  & inrange(rank, -5,5)  , a(competition) cluster(competition)
eststo:  qui reghdfe `var'_post_w award c.rank#i.award     fixed_assets_pre_w  if phase_smei==2  & inrange(rank, -5,5)  , a(competition coordinator_country nace2 year_of_incorporation d_firm_appl_multi_times_ph2 d_win_ph1_apply_ph2) cluster(competition)


}
estfe . est*, labels(nace1 "Sector FE" year_of_incorporation "Cohort FE"  coordinator_country "Country" competition "Competition FE")
esttab est*   using $appendix/Table_G1.tex, append star(* 0.10 ** 0.05 *** 0.01 ) b(3) se(3) stats(N N_hdfe r2, fmt(0 0 2) labels(N "\# FE"  "R-squared"  )) keep(award )  coeflabels(award "Grant" ) mtitles(All All 10 10 All All 10 10) postfoot("") prefoot(\midrule) prehead("\midrule") posthead(\midrule )  booktabs  varwidth(25)
esttab est*   using $appendix/Table_G1.txt, append star(* 0.10 ** 0.05 *** 0.01 ) b(3) se(3) stats(N N_hdfe r2, fmt(0 0 2) labels(N "\# FE"  "R-squared"  )) keep(award )  coeflabels(award "Grant" ) mtitles(All All 10 10 All All 10 10)   varwidth(25)


eststo clear
foreach var in  "assets" "employees" "revenues" {

eststo est_`var'_1:  qui reghdfe `var'_post_w award c.rank#i.award     `var'_pre_w  if phase_smei==2, a(competition) cluster(competition)
eststo est_`var'_2:  qui reghdfe `var'_post_w award c.rank#i.award     `var'_pre_w  if phase_smei==2, a(competition coordinator_country nace2 year_of_incorporation d_firm_appl_multi_times_ph2 d_win_ph1_apply_ph2) cluster(competition)
eststo est_`var'_3:  qui reghdfe `var'_post_w award c.rank#i.award 	`var'_pre_w  if phase_smei==2  & inrange(rank, -10,10), a(competition) cluster(competition)
eststo est_`var'_4:  qui reghdfe `var'_post_w award c.rank#i.award     `var'_pre_w  if phase_smei==2  & inrange(rank, -10,10), a(competition coordinator_country nace2 year_of_incorporation d_firm_appl_multi_times_ph2 d_win_ph1_apply_ph2) cluster(competition)

eststo est_`var'_5:  qui reghdfe `var'_post_w award c.rank#i.award 	`var'_pre_w  if phase_smei==2  & inrange(rank, -5,5), a(competition) cluster(competition)
eststo est_`var'_6:  qui reghdfe `var'_post_w award c.rank#i.award     `var'_pre_w  if phase_smei==2  & inrange(rank, -5,5), a(competition coordinator_country nace2 year_of_incorporation d_firm_appl_multi_times_ph2 d_win_ph1_apply_ph2) cluster(competition)
}
esttab est_assets_*    using $appendix/Table_G1.tex, append star(* 0.10 ** 0.05 *** 0.01 ) b(3) se(3) stats(N N_hdfe r2, fmt(0 0 2) labels(N "\# FE"  "R-squared" )) keep(award )  coeflabels(award "Grant" ) mtitles(All All 10 10 All All 10 10) postfoot("") prefoot(\midrule) prehead("\midrule") posthead(\midrule )  booktabs varwidth(25)
esttab est_employees_*   using $appendix/Table_G1.tex, append star(* 0.10 ** 0.05 *** 0.01 ) b(3) se(3) stats(N N_hdfe r2, fmt(0 0 2) labels(N "\# FE" "R-squared" )) keep(award )  coeflabels(award "Grant" ) mtitles(All All 10 10 All All 10 10) postfoot("") prefoot(\midrule) prehead("\midrule") posthead(\midrule )  booktabs  varwidth(25)
esttab est_revenues_*   using $appendix/Table_G1.tex, append star(* 0.10 ** 0.05 *** 0.01 ) b(3) se(3) stats(N N_hdfe r2, fmt(0 0 2) labels(N "\# FE"  "R-squared"  )) keep(award )  coeflabels(award "Grant" ) mtitles(All All 10 10 All All 10 10) postfoot("") prefoot(\midrule) prehead("\midrule") posthead(\midrule )  booktabs  varwidth(25)
esttab est_assets_*    using $appendix/Table_G1.txt, append star(* 0.10 ** 0.05 *** 0.01 ) b(3) se(3) stats(N N_hdfe r2, fmt(0 0 2) labels(N "\# FE"  "R-squared" )) keep(award )  coeflabels(award "Grant" ) mtitles(All All 10 10 All All 10 10)  varwidth(25)
esttab est_employees_*   using $appendix/Table_G1.txt, append star(* 0.10 ** 0.05 *** 0.01 ) b(3) se(3) stats(N N_hdfe r2, fmt(0 0 2) labels(N "\# FE" "R-squared" )) keep(award )  coeflabels(award "Grant" ) mtitles(All All 10 10 All All 10 10) varwidth(25)
esttab est_revenues_*   using $appendix/Table_G1.txt, append star(* 0.10 ** 0.05 *** 0.01 ) b(3) se(3) stats(N N_hdfe r2, fmt(0 0 2) labels(N "\# FE"  "R-squared"  )) keep(award )  coeflabels(award "Grant" ) mtitles(All All 10 10 All All 10 10) varwidth(25)


eststo clear
foreach var in "exit3"  {

eststo est_`var'_1:  qui reghdfe `var' award c.rank#i.award   if phase_smei==2, a(competition) cluster(competition)
eststo est_`var'_2:  qui reghdfe `var' award c.rank#i.award  if phase_smei==2, a(competition coordinator_country nace2 year_of_incorporation d_firm_appl_multi_times_ph1 ) cluster(competition)
eststo est_`var'_3:  qui reghdfe `var' award c.rank#i.award   if phase_smei==2 & inrange(rank, -10,10),  a(competition) cluster(competition)
eststo est_`var'_4:  qui reghdfe `var' award c.rank#i.award   if phase_smei==2 & inrange(rank, -10,10), a(competition coordinator_country nace2 year_of_incorporation d_firm_appl_multi_times_ph1) cluster(competition)

eststo est_`var'_5:  qui reghdfe `var' award c.rank#i.award   if phase_smei==2 & inrange(rank, -5,5),  a(competition) cluster(competition)
eststo est_`var'_6:  qui reghdfe `var' award c.rank#i.award   if phase_smei==2 & inrange(rank, -5,5), a(competition coordinator_country nace2 year_of_incorporation d_firm_appl_multi_times_ph1) cluster(competition)
}
estfe  est*, labels(nace1 "Sector FE" year_of_incorporation "Cohort FE"  coordinator_country "Country" competition "Competition FE")
esttab est_exit3_* using $appendix/Table_G1.tex, append star(* 0.10 ** 0.05 *** 0.01 ) b(3) se(3) stats(N N_hdfe r2, fmt(0 0 2) labels(N "\# FE"  "R-squared" )) keep(award )  coeflabels(award "Grant" ) mtitles(All All 10 10 All All 10 10) postfoot(\bottomrule \end{tabular}  \end{table})  prefoot(\midrule) prehead("\midrule") posthead(\midrule ) booktabs  varwidth(25)
esttab est_exit3_* using $appendix/Table_G1.txt, append star(* 0.10 ** 0.05 *** 0.01 ) b(3) se(3) stats(N N_hdfe r2, fmt(0 0 2) labels(N "\# FE"  "R-squared" )) keep(award )  coeflabels(award "Grant" ) mtitles(All All 10 10 All All 10 10) varwidth(25)




// Table G2: Alternative standard errors clustering

use $data_path/DATA_ALL_FINAL.dta, clear

* compute dep vars in log levels
gen assets_post = ln(totalassets_tp1)
gen revenues_post = ln(opturnover_tp1)
gen employees_post = ln(numberofemployees_tp1)

foreach var of varlist assets_post revenues_post employees_post  {
		winsor2 `var', cuts(2 98) suff(_w)
}


eststo clear
foreach var in "ln_citw_patents"  {

eststo:  qui reghdfe `var'_post_w award c.rank#i.award     `var'_pre_w  if phase_smei==2, a(competition) cluster(competition)
eststo:  qui reghdfe `var'_post_w award c.rank#i.award     `var'_pre_w  if phase_smei==2, a(competition  ) vce(robust)
eststo:  qui reghdfe `var'_post_w award c.rank#i.award	 `var'_pre_w  if phase_smei==2  & inrange(rank, -10,10), a(competition) cluster(competition)
eststo:  qui reghdfe `var'_post_w award c.rank#i.award     `var'_pre_w  if phase_smei==2  & inrange(rank, -10,10), a(competition  ) vce(robust)
eststo:  qui reghdfe `var'_post_w award c.rank#i.award	 `var'_pre_w  if phase_smei==2  & inrange(rank, -5,5), a(competition) cluster(competition)
eststo:  qui reghdfe `var'_post_w award c.rank#i.award     `var'_pre_w  if phase_smei==2  & inrange(rank, -5,5), a(competition  ) vce(robust)
}
esttab est* using $appendix/Table_G2.tex, replace star(* 0.10 ** 0.05 *** 0.01 ) b(3) se(3) stats(N  r2, fmt(0 2) labels(N  "R-squared" )) keep(award award) coeflabels(award "Grant" ) mtitles(All All 10 10 All All 10 10)   prehead(\begin{table}[htbp]\centering \def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi} \caption{Alternative standard error clustering} \begin{tabular}{l*{9}{c}} \toprule) postfoot("") posthead(\midrule ) booktabs nonotes  varwidth(25)
esttab est* using $appendix/Table_G2.txt, replace star(* 0.10 ** 0.05 *** 0.01 ) b(3) se(3) stats(N  r2, fmt(0 2) labels(N  "R-squared" )) keep(award award) coeflabels(award "Grant" ) mtitles(All All 10 10 All All 10 10)   nonotes  varwidth(25)


eststo clear
foreach var in "pe"  {

eststo:  qui reghdfe `var'_post award c.rank#i.award     `var'_pre  if phase_smei==2  , a(competition) cluster(competition)
eststo:  qui reghdfe `var'_post award c.rank#i.award     `var'_pre  if phase_smei==2  , a(competition  ) vce(robust)
eststo:  qui reghdfe `var'_post award c.rank#i.award	 `var'_pre  if phase_smei==2  & inrange(rank, -10,10)  , a(competition) cluster(competition)
eststo:  qui reghdfe `var'_post award c.rank#i.award     `var'_pre  if phase_smei==2  & inrange(rank, -10,10)  , a(competition  ) vce(robust)
eststo:  qui reghdfe `var'_post award c.rank#i.award	 `var'_pre  if phase_smei==2  & inrange(rank, -5,5)  , a(competition) cluster(competition)
eststo:  qui reghdfe `var'_post award c.rank#i.award     `var'_pre  if phase_smei==2  & inrange(rank, -5,5)  , a(competition  ) vce(robust)
}
estfe . est*, labels(nace1 "Sector FE" year_of_incorporation "Cohort FE"  coordinator_country "Country" competition "Competition FE")
esttab est* using $appendix/Table_G2.tex, append star(* 0.10 ** 0.05 *** 0.01 ) b(3) se(3) stats(N   r2, fmt(0 2) labels(N   "R-squared"  )) keep(award )  coeflabels(award "Grant" ) mtitles(All All 10 10 All All 10 10) postfoot("") prefoot(\midrule) prehead("\midrule") posthead(\midrule )  booktabs  varwidth(25)
esttab est* using $appendix/Table_G2.txt, append star(* 0.10 ** 0.05 *** 0.01 ) b(3) se(3) stats(N   r2, fmt(0 2) labels(N   "R-squared"  )) keep(award )  coeflabels(award "Grant" ) mtitles(All All 10 10 All All 10 10) postfoot("")  varwidth(25)

eststo clear
foreach var in "investment"  {

eststo:  qui reghdfe `var'_post_w award c.rank#i.award     fixed_assets_pre_w  if phase_smei==2  , a(competition) cluster(competition)
eststo:  qui reghdfe `var'_post_w award c.rank#i.award     fixed_assets_pre_w  if phase_smei==2  , a(competition  ) vce(robust)
eststo:  qui reghdfe `var'_post_w award c.rank#i.award	 fixed_assets_pre_w  if phase_smei==2  & inrange(rank, -10,10)  , a(competition) cluster(competition)
eststo:  qui reghdfe `var'_post_w award c.rank#i.award     fixed_assets_pre_w  if phase_smei==2  & inrange(rank, -10,10)  , a(competition  ) vce(robust)
eststo:  qui reghdfe `var'_post_w award c.rank#i.award	 fixed_assets_pre_w  if phase_smei==2  & inrange(rank, -5,5)  , a(competition) cluster(competition)
eststo:  qui reghdfe `var'_post_w award c.rank#i.award     fixed_assets_pre_w  if phase_smei==2  & inrange(rank, -5,5)  , a(competition  ) vce(robust)
}
estfe . est*, labels(nace1 "Sector FE" year_of_incorporation "Cohort FE"  coordinator_country "Country" competition "Competition FE")
esttab est*  using $appendix/Table_G2.tex, append star(* 0.10 ** 0.05 *** 0.01 ) b(3) se(3) stats(N   r2, fmt(0 2) labels(N   "R-squared"  )) keep(award )  coeflabels(award "Grant" ) mtitles(All All 10 10 All All 10 10) postfoot("") prefoot(\midrule) prehead("\midrule") posthead(\midrule )  booktabs  varwidth(25)
esttab est*  using $appendix/Table_G2.txt, append star(* 0.10 ** 0.05 *** 0.01 ) b(3) se(3) stats(N   r2, fmt(0 2) labels(N   "R-squared"  )) keep(award )  coeflabels(award "Grant" ) mtitles(All All 10 10 All All 10 10) varwidth(25)


eststo clear
foreach var in  "assets" "employees" "revenues" {

eststo est_`var'_1:  qui reghdfe `var'_post_w award c.rank#i.award     `var'_pre_w  if phase_smei==2, a(competition) cluster(competition)
eststo est_`var'_2:  qui reghdfe `var'_post_w award c.rank#i.award     `var'_pre_w  if phase_smei==2, a(competition  ) vce(robust)
eststo est_`var'_3:  qui reghdfe `var'_post_w award c.rank#i.award 	`var'_pre_w  if phase_smei==2  & inrange(rank, -10,10), a(competition) cluster(competition)
eststo est_`var'_4:  qui reghdfe `var'_post_w award c.rank#i.award     `var'_pre_w  if phase_smei==2  & inrange(rank, -10,10), a(competition  ) vce(robust)
eststo est_`var'_5:  qui reghdfe `var'_post_w award c.rank#i.award 	`var'_pre_w  if phase_smei==2  & inrange(rank, -5,5), a(competition) cluster(competition)
eststo est_`var'_6:  qui reghdfe `var'_post_w award c.rank#i.award     `var'_pre_w  if phase_smei==2  & inrange(rank, -5,5), a(competition  ) vce(robust)
}
esttab est_assets_*    using $appendix/Table_G2.tex, append star(* 0.10 ** 0.05 *** 0.01 ) b(3) se(3) stats(N   r2, fmt(0 2) labels(N   "R-squared" )) keep(award )  coeflabels(award "Grant" ) mtitles(All All 10 10 All All 10 10) postfoot("") prefoot(\midrule) prehead("\midrule") posthead(\midrule )  booktabs varwidth(25)
esttab est_employees_*   using $appendix/Table_G2.tex, append star(* 0.10 ** 0.05 *** 0.01 ) b(3) se(3) stats(N   r2, fmt(0 2) labels(N   "R-squared" )) keep(award )  coeflabels(award "Grant" ) mtitles(All All 10 10 All All 10 10) postfoot("") prefoot(\midrule) prehead("\midrule") posthead(\midrule )  booktabs  varwidth(25)
esttab est_revenues_*   using $appendix/Table_G2.tex, append star(* 0.10 ** 0.05 *** 0.01 ) b(3) se(3) stats(N   r2, fmt(0 2) labels(N   "R-squared"  )) keep(award )  coeflabels(award "Grant" ) mtitles(All All 10 10 All All 10 10) postfoot("") prefoot(\midrule) prehead("\midrule") posthead(\midrule )  booktabs  varwidth(25)
esttab est_assets_*    using $appendix/Table_G2.txt, append star(* 0.10 ** 0.05 *** 0.01 ) b(3) se(3) stats(N   r2, fmt(0 2) labels(N   "R-squared" )) keep(award )  coeflabels(award "Grant" ) mtitles(All All 10 10 All All 10 10) varwidth(25)
esttab est_employees_*   using $appendix/Table_G2.txt, append star(* 0.10 ** 0.05 *** 0.01 ) b(3) se(3) stats(N   r2, fmt(0 2) labels(N   "R-squared" )) keep(award )  coeflabels(award "Grant" ) mtitles(All All 10 10 All All 10 10)   varwidth(25)
esttab est_revenues_*   using $appendix/Table_G2.txt, append star(* 0.10 ** 0.05 *** 0.01 ) b(3) se(3) stats(N   r2, fmt(0 2) labels(N   "R-squared"  )) keep(award )  coeflabels(award "Grant" ) mtitles(All All 10 10 All All 10 10)  varwidth(25)

eststo clear
foreach var in "exit3"  {

eststo:  qui reghdfe `var' award c.rank#i.award   if phase_smei==2, cluster(competition) a(competition)
eststo:  qui reghdfe `var' award c.rank#i.award   if phase_smei==2, a(competition  ) vce(robust)
eststo:  qui reghdfe `var' award c.rank#i.award   if phase_smei==2  & inrange(rank, -10,10), cluster(competition) a(year_smei#i.nace2)
eststo:  qui reghdfe `var' award c.rank#i.award   if phase_smei==2  & inrange(rank, -10,10),cluster(competition) a(year_smei#i.nace2)
eststo:  qui reghdfe `var' award c.rank#i.award   if phase_smei==2  & inrange(rank, -5,5), cluster(competition) a(year_smei#i.nace2)
eststo:  qui reghdfe `var' award c.rank#i.award   if phase_smei==2  & inrange(rank, -5,5), cluster(competition) a(year_smei#i.nace2)
}
estfe . est*, labels(nace1 "Sector FE" year_of_incorporation "Cohort FE"  coordinator_country "Country" competition "Competition FE")
esttab est* using $appendix/Table_G2.tex, append star(* 0.10 ** 0.05 *** 0.01 ) b(3) se(3) stats(N   r2, fmt(0 2) labels(N   "R-squared" )) keep(award )  coeflabels(award "Grant" ) mtitles(All All 10 10 All All 10 10) postfoot(\bottomrule \end{tabular}  \end{table})  prefoot(\midrule) prehead("\midrule") posthead(\midrule ) booktabs  varwidth(25)
esttab est* using $appendix/Table_G2.txt, append star(* 0.10 ** 0.05 *** 0.01 ) b(3) se(3) stats(N   r2, fmt(0 2) labels(N   "R-squared" )) keep(award )  coeflabels(award "Grant" ) mtitles(All All 10 10 All All 10 10)   varwidth(25)





//////////// Appendix H


// Figure H1: Point estimates by bandwidth

use $data_path/DATA_ALL_FINAL.dta, clear

* compute dep vars in log levels
gen assets_post = ln(totalassets_tp1)
gen revenues_post = ln(opturnover_tp1)
gen employees_post = ln(numberofemployees_tp1)

foreach var of varlist assets_post revenues_post employees_post  {
		winsor2 `var', cuts(2 98) suff(_w)
}

set scheme s1color  
grstyle init newscheme, replace
grstyle set symbolsize 2, pt
grstyle set size 4pt: title
grstyle set size 13pt: subtitle
grstyle set size 9pt: axis_title
grstyle set plain, horizontal nogrid
*grstyle set ci burd, select(11 13) opacity(60)


* PATENTS	
cap graph drop _all
tempname memhold
tempfile results
postfile `memhold' q b cilow cihigh using `results'
forv i = 1(1)25 {
    qui reghdfe ln_citw_patents_post_w award c.rank#i.award ln_citw_patents_pre_w if phase_smei==2 & rank>=-`i'&rank<=`i',  a(competition) cluster(competition)
    local b = _b[award]
    local cilow   = _b[award]- _se[award]  *invnormal(.975)
    local cihigh  = _b[award]+ _se[award]  *invnormal(.975)
    post `memhold' (`i') (`b') (`cilow') (`cihigh')
}
postclose `memhold'
preserve
clear all
use `results'
twoway line b q,  lc(edkblue) lp(solid) lwidth(medthick) || line cihigh q, color(emidblue) lp(longdash) || line cilow q, color(emidblue) lp(longdash) ||, name(rev_1) legend(off) xlabel(1 5 10 15 20 25 , labsize(vsmall))  xtitle(Bandwidth, height(3)) title(Cite weighted patents)
graph save $appendix/9_pat.gph, replace 
restore

* PE
cap graph drop _all
tempname memhold
tempfile results
postfile `memhold' q b cilow cihigh using `results'
forv i = 1(1)25 {
    qui reghdfe pe_post award c.rank#i.award pe_pre if phase_smei==2 & rank>=-`i'&rank<=`i',  a(competition) cluster(competition)
    local b = _b[award]
    local cilow   = _b[award]- _se[award]  *invnormal(.975)
    local cihigh  = _b[award]+ _se[award]  *invnormal(.975)
    post `memhold' (`i') (`b') (`cilow') (`cihigh')
}
postclose `memhold'
preserve
clear all
use `results'
twoway line b q,  lc(edkblue) lp(solid) lwidth(medthick) || line cihigh q, color(emidblue) lp(longdash) || line cilow q, color(edkblue) lp(longdash) ||, name(rev_1) legend(off) xlabel(1 5 10 15 20 25, labsize(vsmall))  xtitle(Bandwidth, height(3)) title(Private Equity)
graph save $appendix/9_pe.gph, replace 
restore

* EMPLOYEES
cap graph drop _all
tempname memhold
tempfile results
postfile `memhold' q b cilow cihigh using `results'
forv i = 1(1)25 {
    qui reghdfe employees_post_w award c.rank#i.award employees_pre_w if phase_smei==2 & rank>=-`i'&rank<=`i',  a(i.year_smei#i.nace2) cluster(i.year_smei#i.nace2)
    local b = _b[award]
    local cilow   = _b[award]- _se[award]  *invnormal(.975)
    local cihigh  = _b[award]+ _se[award]  *invnormal(.975)
    post `memhold' (`i') (`b') (`cilow') (`cihigh')
}
postclose `memhold'
preserve
clear all
use `results'
twoway line b q,  lc(edkblue) lp(solid) lwidth(medthick) || line cihigh q, color(emidblue) lp(longdash) || line cilow q, color(edkblue) lp(longdash) ||, name(rev_1) legend(off) xlabel(1 5 10 15 20 25, labsize(vsmall))  xtitle(Bandwidth, height(3)) title(Employees)
graph save $appendix/9_emp.gph, replace 
restore


* REVENUES
cap graph drop _all
tempname memhold
tempfile results
postfile `memhold' q b cilow cihigh using `results'
forv i = 1(1)25 {
    qui reghdfe revenues_post_w award c.rank#i.award revenues_pre_w if phase_smei==2 & rank>=-`i'&rank<=`i',  a(competition) cluster(competition)
    local b = _b[award]
    local cilow   = _b[award]- _se[award]  *invnormal(.975)
    local cihigh  = _b[award]+ _se[award]  *invnormal(.975)
    post `memhold' (`i') (`b') (`cilow') (`cihigh')
}
postclose `memhold'
preserve
clear all
use `results'
twoway line b q,  lc(edkblue) lp(solid) lwidth(medthick) || line cihigh q, color(emidblue) lp(longdash) || line cilow q, color(edkblue) lp(longdash) ||, name(rev_1) legend(off) xlabel(1 5 10 15 20 25, labsize(vsmall))  xtitle(Bandwidth, height(3)) title(Revenues)
graph save $appendix/9_rev.gph, replace 
restore

* ASSETS
cap graph drop _all
tempname memhold
tempfile results
postfile `memhold' q b cilow cihigh using `results'
forv i = 1(1)25 {
    qui reghdfe assets_post_w /*ln_total_assets_t_post_win2*/ award c.rank#i.award assets_pre_w /*ln_total_assets_t_pre_win2*/ if phase_smei==2 & rank>=-`i'&rank<=`i',  a(competition) cluster(competition)
    local b = _b[award]
    local cilow   = _b[award]- _se[award]  *invnormal(.975)
    local cihigh  = _b[award]+ _se[award]  *invnormal(.975)
    post `memhold' (`i') (`b') (`cilow') (`cihigh')
}
postclose `memhold'
preserve
clear all
use `results'
twoway line b q,  lc(edkblue) lp(solid) lwidth(medthick) || line cihigh q, color(emidblue) lp(longdash) || line cilow q, color(edkblue) lp(longdash) ||, name(rev_1) legend(off) xlabel(1 5 10 15 20 25, labsize(vsmall))  xtitle(Bandwidth, height(3)) title(Assets)
graph save $appendix/9_ass.gph, replace 
restore

* EXIT
cap graph drop _all
tempname memhold
tempfile results
postfile `memhold' q b cilow cihigh using `results'
forv i = 1(1)25 {
    qui reghdfe exit3 award c.rank#i.award if phase_smei==2 & rank>=-`i'&rank<=`i',  a(i.year_smei#i.nace2) cluster(i.year_smei#i.nace2)
    local b = _b[award]
    local cilow   = _b[award]- _se[award]  *invnormal(.975)
    local cihigh  = _b[award]+ _se[award]  *invnormal(.975)
    post `memhold' (`i') (`b') (`cilow') (`cihigh')
}
postclose `memhold'
preserve
clear all
use `results'
twoway line b q,  lc(edkblue) lp(solid) lwidth(medthick) || line cihigh q, color(emidblue) lp(longdash) || line cilow q, color(edkblue) lp(longdash) ||, name(rev_1) legend(off) xlabel(1 5 10 15 20 25, labsize(vsmall)) xtitle(Bandwidth, height(3)) title(Failure) graphregion(margin(l-9))
graph save $appendix/9_exit.gph, replace 
restore


cap graph close

graph combine $appendix/9_pat.gph $appendix/9_pe.gph $appendix/9_ass.gph $appendix/9_emp.gph  $appendix/9_rev.gph $appendix/9_exit.gph, col(3) xcommon iscale(*.8)
graph export $appendix/Figure_H1.png, replace width(2200)
cap graph drop _all


cap erase $appendix/9_exit.gph
cap erase $appendix/9_ass.gph
cap erase $appendix/9_rev.gph
cap erase $appendix/9_emp.gph
cap erase $appendix/9_pe.gph
cap erase $appendix/9_pat.gph

erase scheme-newscheme.scheme




// Table H1: Estimates using narrow bandwidths around the threshold

use $data_path/DATA_ALL_FINAL.dta, clear


eststo clear
foreach var in "ln_citw_patents"  {
eststo:  qui reghdfe `var'_post_w  award   			    if phase_smei==2 & inrange(rank, -2,2), a(competition) cluster(competition)
eststo:  qui reghdfe `var'_post_w  award   `var'_pre_w  if phase_smei==2 & inrange(rank, -2,2), a(competition) cluster(competition)
eststo:  qui reghdfe `var'_post_w  award                if phase_smei==2 & inrange(rank, -1,1), a(competition) cluster(competition)
eststo:  qui reghdfe `var'_post_w  award   `var'_pre_w  if phase_smei==2 & inrange(rank, -1,1), a(competition) cluster(competition)
}
foreach var in "pe"  {
eststo:  qui reghdfe `var'_post  award   			    if phase_smei==2 & inrange(rank, -2,2), a(competition) cluster(competition)
eststo:  qui reghdfe `var'_post  award   `var'_pre      if phase_smei==2 & inrange(rank, -2,2), a(competition) cluster(competition)
eststo:  qui reghdfe `var'_post  award                  if phase_smei==2 & inrange(rank, -1,1), a(competition) cluster(competition)
eststo:  qui reghdfe `var'_post  award   `var'_pre      if phase_smei==2 & inrange(rank, -1,1), a(competition) cluster(competition)
}
esttab est* using $appendix/Table_H1.tex, replace star(* 0.10 ** 0.05 *** 0.01 ) b(3) se(3) stats(N  r2, fmt(0 2) labels(N  "R-squared" )) keep(award award) coeflabels(award "Grant" ) mtitles(All All 10 10 All All 10 10)   prehead(\begin{table}[htbp]\centering \def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi} \caption{Alternative standard error clustering} \begin{tabular}{l*{9}{c}} \toprule) postfoot("") posthead(\midrule ) booktabs nonotes  varwidth(25)
esttab est* using $appendix/Table_H1.txt, replace star(* 0.10 ** 0.05 *** 0.01 ) b(3) se(3) stats(N  r2, fmt(0 2) labels(N  "R-squared" )) keep(award award) coeflabels(award "Grant" ) mtitles(All All 10 10 All All 10 10)   nonotes  varwidth(25)

eststo clear
foreach var in "investment"  {
eststo:  qui reghdfe `var'_post_w  award   			    if phase_smei==2 & inrange(rank, -2,2), a(competition) cluster(competition)
eststo:  qui reghdfe `var'_post_w  award  fixed_assets_pre_w    if phase_smei==2 & inrange(rank, -2,2), a(competition) cluster(competition)
eststo:  qui reghdfe `var'_post_w  award                  if phase_smei==2 & inrange(rank, -1,1), a(competition) cluster(competition)
eststo:  qui reghdfe `var'_post_w  award  fixed_assets_pre_w  if phase_smei==2 & inrange(rank, -1,1), a(competition) cluster(competition)
}
foreach var in "assets"  {
eststo:  qui reghdfe `var'_2_w   award   			  if phase_smei==2 & inrange(rank, -2,2), a(competition) cluster(competition)
eststo:  qui reghdfe `var'_2_w   award   `var'_pre_w  if phase_smei==2 & inrange(rank, -2,2), a(competition) cluster(competition)
eststo:  qui reghdfe `var'_2_w   award                if phase_smei==2 & inrange(rank, -1,1), a(competition) cluster(competition)
eststo:  qui reghdfe `var'_2_w   award   `var'_pre_w  if phase_smei==2 & inrange(rank, -1,1), a(competition) cluster(competition)
}
esttab est* using $appendix/Table_H1.tex, append star(* 0.10 ** 0.05 *** 0.01 ) b(3) se(3) stats(N  r2, fmt(0 2) labels(N  "R-squared" )) keep(award award) coeflabels(award "Grant" ) mtitles(All All 10 10 All All 10 10)   prehead(\begin{table}[htbp]\centering \def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi} \caption{Alternative standard error clustering} \begin{tabular}{l*{9}{c}} \toprule) postfoot("") posthead(\midrule ) booktabs nonotes  varwidth(25)
esttab est* using $appendix/Table_H1.txt, append star(* 0.10 ** 0.05 *** 0.01 ) b(3) se(3) stats(N  r2, fmt(0 2) labels(N  "R-squared" )) keep(award award) coeflabels(award "Grant" ) mtitles(All All 10 10 All All 10 10)    nonotes  varwidth(25)

eststo clear
foreach var in "employees"  {
eststo:  qui reghdfe `var'_2_w   award   			  if phase_smei==2 & inrange(rank, -2,2), a(competition) cluster(competition)
eststo:  qui reghdfe `var'_2_w   award   `var'_pre_w  if phase_smei==2 & inrange(rank, -2,2), a(competition) cluster(competition)
eststo:  qui reghdfe `var'_2_w   award                if phase_smei==2 & inrange(rank, -1,1), a(competition) cluster(competition)
eststo:  qui reghdfe `var'_2_w   award   `var'_pre_w  if phase_smei==2 & inrange(rank, -1,1), a(competition) cluster(competition)
}
foreach var in "revenues"  {
eststo:  qui reghdfe `var'_2_w   award   			  if phase_smei==2 & inrange(rank, -2,2), a(competition) cluster(competition)
eststo:  qui reghdfe `var'_2_w   award   `var'_pre_w  if phase_smei==2 & inrange(rank, -2,2), a(competition) cluster(competition)
eststo:  qui reghdfe `var'_2_w   award                if phase_smei==2 & inrange(rank, -1,1), a(competition) cluster(competition)
eststo:  qui reghdfe `var'_2_w   award   `var'_pre_w  if phase_smei==2 & inrange(rank, -1,1), a(competition) cluster(competition)
}
esttab est* using $appendix/Table_H1.tex, append star(* 0.10 ** 0.05 *** 0.01 ) b(3) se(3) stats(N  r2, fmt(0 2) labels(N  "R-squared" )) keep(award award) coeflabels(award "Grant" ) mtitles(All All 10 10 All All 10 10)   prehead(\begin{table}[htbp]\centering \def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi} \caption{Alternative standard error clustering} \begin{tabular}{l*{9}{c}} \toprule) postfoot("") posthead(\midrule ) booktabs nonotes  varwidth(25)
esttab est* using $appendix/Table_H1.txt, append star(* 0.10 ** 0.05 *** 0.01 ) b(3) se(3) stats(N  r2, fmt(0 2) labels(N  "R-squared" )) keep(award award) coeflabels(award "Grant" ) mtitles(All All 10 10 All All 10 10)    nonotes  varwidth(25)




//////////// Appendix I



// Table I1: Robust bias-corrected local polynomial estimates with data-driven bandwidths

use $data_path/DATA_ALL_FINAL.dta, clear

* compute dep vars in log levels
gen assets_post = ln(totalassets_tp1)
gen revenues_post = ln(opturnover_tp1)
gen employees_post = ln(numberofemployees_tp1)

foreach var of varlist assets_post revenues_post employees_post  {
		winsor2 `var', cuts(2 98) suff(_w)
}


cap drop sample*
qui reghdfe ln_citw_patents_post_w award i.award#c.rank ln_citw_patents_pre_w if phase_smei==2, a(competition) cluster(competition)
gen sample2 = e(sample)

eststo clear
eststo: xi: rdrobust ln_citw_patents_post_w rank if phase_smei==2 & sample2, c(0) p(1) covs(ln_citw_patents_pre_w i.competition) vce(cluster competition)
eststo: xi: rdrobust ln_citw_patents_post_w rank if phase_smei==2 & sample2, c(0) p(2) covs(ln_citw_patents_pre_w i.competition) vce(cluster competition)
eststo: xi: rdrobust ln_citw_patents_post_w rank if phase_smei==2 & sample2, c(0) p(1) covs(ln_citw_patents_pre_w i.competition) bwselect( msetwo) vce(cluster competition)
eststo: xi: rdrobust ln_citw_patents_post_w rank if phase_smei==2 & sample2, c(0) p(2) covs(ln_citw_patents_pre_w i.competition) bwselect( msetwo) vce(cluster competition)
esttab est* using $appendix/Table_I1.tex, varwidth(30) f legend label replace star(* 0.10 ** 0.05 *** 0.01 ) cells(b(star fmt(3) vacant({--})) ) ///
stats(se_tau_rb  pv_rb  bwselect N_h_l N_h_r p h_l h_r, fmt(3 3 0 0 0 0 1 1) labels(`"Robust SE"' `"Robust p-value"'  `"BW Type"' `"N left"'  `"N right"' `"Order Poly."'  `"BW left"' `"BW right"'))

cap drop sample*
qui reghdfe pe_post award i.award#c.rank pe_pre if phase_smei==2, a(competition) cluster(competition)
gen sample2 = e(sample)

eststo clear
eststo: xi: rdrobust pe_post rank if phase_smei==2 & sample2, c(0) p(1) covs(pe_pre i.competition) vce(cluster competition)
eststo: xi: rdrobust pe_post rank if phase_smei==2 & sample2, c(0) p(2) covs(pe_pre i.competition) vce(cluster competition)
eststo: xi: rdrobust pe_post rank if phase_smei==2 & sample2, c(0) p(1) covs(pe_pre i.competition) bwselect( msetwo) vce(cluster competition)
eststo: xi: rdrobust pe_post rank if phase_smei==2 & sample2, c(0) p(2) covs(pe_pre i.competition) bwselect( msetwo) vce(cluster competition)
esttab est* using $appendix/Table_I1.tex, varwidth(30) f legend label append star(* 0.10 ** 0.05 *** 0.01 ) cells(b(star fmt(3) vacant({--})) ) ///
stats(se_tau_rb  pv_rb  bwselect N_h_l N_h_r p h_l h_r, fmt(3 3 0 0 0 0 1 1) labels(`"Robust SE"' `"Robust p-value"'  `"BW Type"' `"N left"'  `"N right"' `"Order Poly."'  `"BW left"' `"BW right"'))

cap drop sample*
qui reghdfe investment_post_w award i.award#c.rank fixed_assets_pre_w if phase_smei==2, a(competition) cluster(competition)
gen sample2 = e(sample)

eststo clear
eststo: xi: rdrobust investment_post_w rank if phase_smei==2 & sample2, c(0) p(1) covs(fixed_assets_pre_w i.competition) vce(cluster competition)
eststo: xi: rdrobust investment_post_w rank if phase_smei==2 & sample2, c(0) p(2) covs(fixed_assets_pre_w i.competition) vce(cluster competition)
eststo: xi: rdrobust investment_post_w rank if phase_smei==2 & sample2, c(0) p(1) covs(fixed_assets_pre_w i.competition) bwselect( msetwo) vce(cluster competition)
eststo: xi: rdrobust investment_post_w rank if phase_smei==2 & sample2, c(0) p(2) covs(fixed_assets_pre_w i.competition) bwselect( msetwo) vce(cluster competition)
esttab est* using $appendix/Table_I1.tex, varwidth(30) f legend label append star(* 0.10 ** 0.05 *** 0.01 ) cells(b(star fmt(3) vacant({--})) ) ///
stats(se_tau_rb  pv_rb  bwselect N_h_l N_h_r p h_l h_r, fmt(3 3 0 0 0 0 1 1) labels(`"Robust SE"' `"Robust p-value"'  `"BW Type"' `"N left"'  `"N right"' `"Order Poly."'  `"BW left"' `"BW right"'))


cap drop sample*
qui reghdfe assets_post_w award i.award#c.rank assets_pre_w if phase_smei==2, a(competition) cluster(competition)
gen sample2 = e(sample)

eststo clear
eststo: xi: rdrobust assets_post_w rank if phase_smei==2 & sample2, c(0) p(1) covs(assets_pre_w i.competition) vce(cluster competition)
eststo: xi: rdrobust assets_post_w rank if phase_smei==2 & sample2, c(0) p(2) covs(assets_pre_w i.competition) vce(cluster competition)
eststo: xi: rdrobust assets_post_w rank if phase_smei==2 & sample2, c(0) p(1) covs(assets_pre_w i.competition) bwselect( msetwo) vce(cluster competition)
eststo: xi: rdrobust assets_post_w rank if phase_smei==2 & sample2, c(0) p(2) covs(assets_pre_w i.competition) bwselect( msetwo) vce(cluster competition)
esttab est* using $appendix/Table_I1.tex, varwidth(30) f legend label append star(* 0.10 ** 0.05 *** 0.01 ) cells(b(star fmt(3) vacant({--})) ) ///
stats(se_tau_rb  pv_rb  bwselect N_h_l N_h_r p h_l h_r, fmt(3 3 0 0 0 0 1 1)labels(`"Robust SE"' `"Robust p-value"'  `"BW Type"' `"N left"'  `"N right"' `"Order Poly."'  `"BW left"' `"BW right"'))

	
// Table I2: Robust bias-corrected local polynomial estimates with data-driven bandwidths

	
cap drop sample*
qui reghdfe employees_post_w award i.award#c.rank employees_pre_w if phase_smei==2, a(competition) cluster(competition)
gen sample2 = e(sample)

eststo clear
eststo: xi: rdrobust employees_post_w rank if phase_smei==2 & sample2, c(0) p(1) covs(employees_pre_w i.competition) vce(cluster competition) 
eststo: xi: rdrobust employees_post_w rank if phase_smei==2 & sample2, c(0) p(2) covs(employees_pre_w i.competition) vce(cluster competition)
eststo: xi: rdrobust employees_post_w rank if phase_smei==2 & sample2, c(0) p(1) covs(employees_pre_w i.competition) bwselect( msetwo) vce(cluster competition)
eststo: xi: rdrobust employees_post_w rank if phase_smei==2 & sample2, c(0) p(2) covs(employees_pre_w i.competition) bwselect( msetwo) vce(cluster competition)
esttab est* using $appendix/Table_I2.tex, varwidth(30) f legend label replace star(* 0.10 ** 0.05 *** 0.01 ) cells(b(star fmt(3) vacant({--})) ) ///
stats(se_tau_cl  pv_cl  bwselect N_h_l N_h_r p h_l h_r, fmt(3 3 0 0 0 0 1 1) labels(`"Robust SE"' `"Robust p-value"'  `"BW Type"' `"N left"'  `"N right"' `"Order Poly."'  `"BW left"' `"BW right"'))    


cap drop sample*
qui reghdfe revenues_post_w award i.award#c.rank revenues_pre_w if phase_smei==2, a(competition) cluster(competition)
gen sample2 = e(sample)  

eststo clear
eststo: xi: rdrobust revenues_post_w rank if phase_smei==2 & sample2, c(0) p(1) covs(revenues_pre_w i.competition) vce(cluster competition)
eststo: xi: rdrobust revenues_post_w rank if phase_smei==2 & sample2, c(0) p(2) covs(revenues_pre_w i.competition) vce(cluster competition)
eststo: xi: rdrobust revenues_post_w rank if phase_smei==2 & sample2, c(0) p(1) covs(revenues_pre_w i.competition) bwselect( msetwo) vce(cluster competition)
eststo: xi: rdrobust revenues_post_w rank if phase_smei==2 & sample2, c(0) p(2) covs(revenues_pre_w i.competition) bwselect( msetwo) vce(cluster competition)
esttab est* using $appendix/Table_I2.tex, varwidth(30) f legend label append star(* 0.10 ** 0.05 *** 0.01 ) cells(b(star fmt(3) vacant({--})) ) ///
stats(se_tau_rb  pv_rb  bwselect N_h_l N_h_r p h_l h_r, fmt(3 3 0 0 0 0 1 1) labels(`"Robust SE"' `"Robust p-value"'  `"BW Type"' `"N left"'  `"N right"' `"Order Poly."'  `"BW left"' `"BW right"'))    

cap drop sample*
qui reghdfe exit3 award i.award#c.rank  if phase_smei==2, a(competition) cluster(competition)
gen sample2 = e(sample)  

eststo clear
eststo: xi: rdrobust exit3 rank if phase_smei==2 & sample2, c(0) p(1)  covs(i.competition) vce(cluster competition)
eststo: xi: rdrobust exit3 rank if phase_smei==2 & sample2, c(0) p(2)  covs(i.competition) vce(cluster competition)
eststo: xi: rdrobust exit3 rank if phase_smei==2 & sample2, c(0) p(1)  covs(i.competition) bwselect( msetwo) vce(cluster competition)
eststo: xi: rdrobust exit3 rank if phase_smei==2 & sample2, c(0) p(2)  covs(i.competition) bwselect( msetwo) vce(cluster competition)
esttab est* using $appendix/Table_I2.tex, varwidth(30) f legend label append star(* 0.10 ** 0.05 *** 0.01 ) cells(b(star fmt(3) vacant({--})) ) ///
stats(se_tau_rb  pv_rb  bwselect N_h_l N_h_r p h_l h_r, fmt(3 3 0 0 0 0 1 1) labels(`"Robust SE"' `"Robust p-value"'  `"BW Type"' `"N left"'  `"N right"' `"Order Poly"'  `"BW left"' `"BW right"'))
	
	



///////////// Appendix J 	
	
	
// Table J1 and J2: Local Randomization analysis 


use $data_path/DATA_ALL_FINAL.dta, clear

* compute dep vars in log levels
gen assets_post = ln(totalassets_tp1)
gen revenues_post = ln(opturnover_tp1)
gen employees_post = ln(numberofemployees_tp1)

foreach var of varlist assets_post revenues_post employees_post  {
		winsor2 `var', cuts(2 98) suff(_w)
}


* define sample
cap drop *sample
reghdfe ln_citw_patents_post_w award rank ln_citw_patents_pre_w if inrange(rank,-1,1), noa
gen pat_sample = e(sample)
reghdfe pe_post award rank pe_pre if inrange(rank,-1,1), noa
gen pe_sample = e(sample)
reghdfe investment_post_w award rank  if inrange(rank,-1,1), noa
gen inv_sample = e(sample)
reghdfe assets_post_w award rank assets_pre_w if inrange(rank,-1,1), noa
gen ass_sample = e(sample)
reghdfe employees_post_w award rank employees_pre_w if inrange(rank,-1,1), noa
gen emp_sample = e(sample)
reghdfe revenues_post_w award rank revenues_pre_w if inrange(rank,-1,1), noa
gen rev_sample = e(sample)
reghdfe exit3 award rank  if inrange(rank,-1,1), noa
gen exi_sample = e(sample)
cap drop ln_age
gen ln_age = ln(age)
reghdfe ln_age award rank  if inrange(rank,-1,1), noa
gen age_sample = e(sample)
reghdfe high_tech award rank  if inrange(rank,-1,1), noa
gen tec_sample = e(sample)


rdrandinf ln_citw_patents_pre_w rank if phase_smei==2  & pat_sample, wl(-1) wr(1) seed(150) reps(1000) 
matrix ln_citw_patents_pre_w = r(obs_stat), r(asy_pval), r(N)    
esttab matrix(ln_citw_patents_pre_w) using $appendix/Table_J1.tex, replace
esttab matrix(ln_citw_patents_pre_w) using $appendix/Table_J1.txt, replace
rdrandinf pe_pre rank if phase_smei==2  & pat_sample, wl(-1) wr(1) seed(150) reps(1000) 
matrix pe_pre = r(obs_stat), r(asy_pval), r(N) 
esttab matrix(pe_pre) using $appendix/Table_J1.tex, append
esttab matrix(pe_pre) using $appendix/Table_J1.txt, append
rdrandinf investment_pre_w rank if phase_smei==2 , wl(-1) wr(1) seed(150) reps(1000)
matrix investment_pre_w = r(obs_stat), r(asy_pval), r(N)  
esttab matrix(investment_pre_w) using $appendix/Table_J1.tex, append
esttab matrix(investment_pre_w) using $appendix/Table_J1.txt, append
rdrandinf assets_pre_w rank if phase_smei==2 & ass_sample, wl(-1) wr(1) seed(150) reps(1000)
matrix assets_pre_w = r(obs_stat), r(asy_pval), r(N) 
esttab matrix(assets_pre_w) using $appendix/Table_J1.tex, append
esttab matrix(assets_pre_w) using $appendix/Table_J1.txt, append
rdrandinf employees_pre_w rank if phase_smei==2  & emp_sample, wl(-1) wr(1) seed(150) reps(1000)
matrix employees_pre_w = r(obs_stat), r(asy_pval), r(N) 
esttab matrix(employees_pre_w) using $appendix/Table_J1.tex, append
esttab matrix(employees_pre_w) using $appendix/Table_J1.txt, append
rdrandinf revenues_pre_w rank if phase_smei==2 & rev_sample, wl(-1) wr(1) seed(150) reps(1000)
matrix revenues_pre_w = r(obs_stat), r(asy_pval), r(N)  
esttab matrix(revenues_pre_w) using $appendix/Table_J1.tex, append
esttab matrix(revenues_pre_w) using $appendix/Table_J1.txt, append
rdrandinf ln_age rank if phase_smei==2 & age_sample, wl(-1) wr(1) seed(150) reps(1000)
matrix ln_age = r(obs_stat), r(asy_pval), r(N)   
esttab matrix(ln_age) using $appendix/Table_J1.tex, append
esttab matrix(ln_age) using $appendix/Table_J1.txt, append

// Table J2: Local Randomization estimates

rdrandinf ln_citw_patents_post_w rank if phase_smei==2 & pat_sample, wl(-1) wr(1) seed(150) reps(1000)
rdrandinf pe_post rank if phase_smei==2  & pe_sample, wl(-1) wr(1) seed(150) reps(1000)
rdrandinf investment_post_w rank if phase_smei==2 & inv_sample, wl(-1) wr(1) seed(150) reps(1000)
rdrandinf assets_post_w rank if phase_smei==2 & ass_sample, wl(-1) wr(1) seed(150) reps(1000)
rdrandinf employees_post_w rank if phase_smei==2 & emp_sample, wl(-1) wr(1) seed(150) reps(1000)
rdrandinf revenues_post_w rank if phase_smei==2 & rev_sample, wl(-1) wr(1) seed(150) reps(1000)
rdrandinf exit3 rank if phase_smei==2 & exi_sample, wl(-1) wr(1) seed(150) reps(1000)

rdrandinf ln_citw_patents_post_w rank if phase_smei==2  & pat_sample, wl(-1) wr(1) seed(150) reps(1000) 
matrix ln_citw_patents_post_w = r(obs_stat), r(asy_pval), r(N) 
esttab matrix(ln_citw_patents_post_w) using $appendix/Table_J2.tex, replace
esttab matrix(ln_citw_patents_post_w) using $appendix/Table_J2.txt, replace
rdrandinf pe_post rank if phase_smei==2  & pat_sample, wl(-1) wr(1) seed(150) reps(1000) 
matrix pe_post = r(obs_stat), r(asy_pval), r(N) 
esttab matrix(pe_post) using $appendix/Table_J2.tex, append
esttab matrix(pe_post) using $appendix/Table_J2.txt, append
rdrandinf investment_post_w rank if phase_smei==2 , wl(-1) wr(1) seed(150) reps(1000)
matrix investment_post_w = r(obs_stat), r(asy_pval), r(N) 
esttab matrix(investment_post_w) using $appendix/Table_J2.tex, append
esttab matrix(investment_post_w) using $appendix/Table_J2.txt, append
rdrandinf assets_post_w rank if phase_smei==2 & ass_sample, wl(-1) wr(1) seed(150) reps(1000)
matrix assets_post_w = r(obs_stat), r(asy_pval), r(N) 
esttab matrix(assets_post_w) using $appendix/Table_J2.tex, append
esttab matrix(assets_post_w) using $appendix/Table_J2.txt, append
rdrandinf employees_post_w rank if phase_smei==2  & emp_sample, wl(-1) wr(1) seed(150) reps(1000)
matrix employees_post_w = r(obs_stat), r(asy_pval), r(N) 
esttab matrix(employees_post_w) using $appendix/Table_J2.tex, append
esttab matrix(employees_post_w) using $appendix/Table_J2.txt, append
rdrandinf revenues_post_w rank if phase_smei==2 & rev_sample, wl(-1) wr(1) seed(150) reps(1000)
matrix revenues_post_w = r(obs_stat), r(asy_pval), r(N) 
esttab matrix(revenues_post_w) using $appendix/Table_J2.tex, append
esttab matrix(revenues_post_w) using $appendix/Table_J2.txt, append
rdrandinf exit3 rank if phase_smei==2 & age_sample, wl(-1) wr(1) seed(150) reps(1000)
matrix exit3 = r(obs_stat), r(asy_pval), r(N) 
esttab matrix(exit3) using $appendix/Table_J2.tex, append
esttab matrix(exit3) using $appendix/Table_J2.txt, append




////////// Appendix K



// Table K1 and K2: Difference-in-differences

use $data_path/DATA_ALL_FINAL.dta, clear

cap drop id
gen id = _n

* rename cross-sectional variables to reshape
rename opturnover_tm4 turnover1
rename opturnover_tm3 turnover2
rename opturnover_tm2 turnover3
rename opturnover_tm1 turnover4
rename opturnover_t   turnover5
rename opturnover_tp1 turnover6
rename opturnover_tp2 turnover7
rename opturnover_tp3 turnover8
rename opturnover_tp4 turnover9

rename totalassets_tm4 totalassets1
rename totalassets_tm3 totalassets2
rename totalassets_tm2 totalassets3
rename totalassets_tm1 totalassets4
rename totalassets_t   totalassets5
rename totalassets_tp1 totalassets6
rename totalassets_tp2 totalassets7
rename totalassets_tp3 totalassets8
rename totalassets_tp4 totalassets9

rename numberofemployees_tm4 n_employees1
rename numberofemployees_tm3 n_employees2
rename numberofemployees_tm2 n_employees3
rename numberofemployees_tm1 n_employees4
rename numberofemployees_t   n_employees5
rename numberofemployees_tp1 n_employees6
rename numberofemployees_tp2 n_employees7
rename numberofemployees_tp3 n_employees8
rename numberofemployees_tp4 n_employees9

gen pe_d4 = pe_pre
gen pe_d5 = pe_post

gen pe_amount4 = ln(pe_amount_pre + 1) if pe_amount_pre!=.
gen pe_amount5 = ln(pe_amount_post + pe_amount_pre + 1) if pe_amount_post!=. & pe_amount_pre!=.

* reshape dataset from wide to long
reshape long turnover totalassets n_employees pe_d pe_amount, i(id) j(year) 

xtset id year
cap drop post
by id: gen post = (year>=5)

gen  year2 = (year_smei - 5) + year
order id year year2 year_smei award post turnover
replace year = year2
drop year2

cap drop post
by id: gen post = (year>=year_smei)

* generate variables for DID
gen ln_turnover =  ln(turnover)
gen ln_totalassets = ln(totalassets)
gen ln_employees = ln(n_employees)
winsor2 ln_employees ln_totalassets ln_turnover, cuts(2 98)
gen employees = n_employees 

* Two-period DID vars
cap drop new_pat new_pat_cum
bys id (year): gen new_pat = ln_citw_patents_post_w if year==year_smei
bys id (year): replace  new_pat = ln_citw_patents_pre_w if year_smei-year==1
bys id (year): gen new_pat_cum = sum(new_pat) if new_pat!=.

foreach var of varlist turnover totalassets employees {
cap drop totass totass_mean
bys id (year): gen `var'_temp = ln_`var' if year==year_smei
bys id (year): replace  `var'_temp = ln_`var' if year-year_smei==1
bys id (year): replace  `var'_temp = ln_`var' if year_smei-year==1
bys id (year): egen `var'_mean = mean(`var'_temp) if year>=year_smei & `var'_temp!=.
bys id (year): replace `var'_mean = ln_`var' if year_smei-year==1
bys id (year): replace `var'_mean = . if year-year_smei==1 
}




* Two-period DID models for patents
eststo clear
foreach var of varlist  new_pat_cum {
eststo: qui reghdfe `var' i.award##i.post i.award#c.rank   if phase_smei==2 , a(year competition) cluster(competition)
eststo: qui reghdfe `var' i.award##i.post i.award#c.rank   if phase_smei==2 , a(year competition year_of_incorporation nace2 Country_iso_code) cluster(competition)
eststo: qui reghdfe `var' i.award##i.post                  if phase_smei==2 , a(year id ) cluster(competition)
eststo: qui reghdfe `var' i.award##i.post i.award#c.rank   if phase_smei==2  & inrange(rank,-10,10), a(year competition  year_of_incorporation nace2 Country_iso_code) cluster(competition)
eststo: qui reghdfe `var' i.award##i.post                  if phase_smei==2  & inrange(rank,-10,10), a(year id ) cluster(competition)
eststo: qui reghdfe `var' i.award##i.post i.award#c.rank   if phase_smei==2  & inrange(rank,-5,5), a(year competition  year_of_incorporation nace2 Country_iso_code) cluster(competition)
eststo: qui reghdfe `var' i.award##i.post                  if phase_smei==2  & inrange(rank,-5,5), a(year  id ) cluster(competition)
}
estfe . est*, labels(nace2 "Sector FE" year_of_incorporation "Cohort FE" competition "Competition FE" year "Year FE" Country_iso_code "Country FE" id "Firm-application FE")
esttab est1 est2 est3 est4 est5 est6 est7 using $appendix/Table_K1.tex, replace star(* 0.10 ** 0.05 *** 0.01 ) b(3) se(3) stats(N  N_clust r2, fmt(0 0 2) labels(N "\# competitions" "R-squared" )) mtitles(All All All 10 10 5 5 ) coeflabels(1.award "Grant" 1.post "Post" 1.award#1.post "Award $\times$ Post" ) keep(1.award#1.post) prehead(\begin{table}[htbp]\centering \def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi} \caption{Diff-in-diff models} \begin{tabular}{l*{7}{c}} \toprule) postfoot("") posthead(\midrule \textbf{Panel A: Patent}\\) booktabs nonotes indicate(/* "Age=age" "Age squared=c.age#c.age" */ "Rank $\times$ Award=*.award#c.rank"  `r(indicate_fe)') varwidth(25)
esttab est1 est2 est3 est4 est5 est6 est7 using $appendix/Table_K1.txt, replace star(* 0.10 ** 0.05 *** 0.01 ) b(3) se(3) stats(N  N_clust r2, fmt(0 0 2) labels(N "\# competitions" "R-squared" )) mtitles(All All All 10 10 5 5 ) coeflabels(1.award "Grant" 1.post "Post" 1.award#1.post "Award $\times$ Post" ) keep(1.award#1.post) nonotes indicate(/* "Age=age" "Age squared=c.age#c.age" */ "Rank $\times$ Award=*.award#c.rank"  `r(indicate_fe)') varwidth(25)

* Two-period DID models for private equity
eststo clear
foreach var of varlist  pe_amount {
eststo: qui reghdfe `var' i.award##i.post i.award#c.rank   if phase_smei==2  , a(year competition) cluster(competition)
eststo: qui reghdfe `var' i.award##i.post i.award#c.rank   if phase_smei==2  , a(year competition year_of_incorporation nace2 Country_iso_code) cluster(competition)
eststo: qui reghdfe `var' i.award##i.post                  if phase_smei==2  , a(year id ) cluster(competition)
eststo: qui reghdfe `var' i.award##i.post i.award#c.rank   if phase_smei==2  & inrange(rank,-10,10), a(year competition  year_of_incorporation nace2 Country_iso_code) cluster(competition)
eststo: qui reghdfe `var' i.award##i.post                  if phase_smei==2  & inrange(rank,-10,10), a(year id ) cluster(competition)
eststo: qui reghdfe `var' i.award##i.post i.award#c.rank   if phase_smei==2  & inrange(rank,-5,5), a(year competition  year_of_incorporation nace2 Country_iso_code) cluster(competition)
eststo: qui reghdfe `var' i.award##i.post                  if phase_smei==2  & inrange(rank,-5,5), a(year   id ) cluster(competition)
}
estfe . est*, labels(nace2 "Sector FE" year_of_incorporation "Cohort FE" competition "Competition FE" year "Year FE" Country_iso_code "Country FE" id "Firm-application FE")
esttab est1 est2 est3 est4 est5 est6 est7 using $appendix/Table_K1.tex, append star(* 0.10 ** 0.05 *** 0.01 ) b(3) se(3) stats(N  N_clust r2, fmt(0 0 2) labels(N "\# competitions" "R-squared" )) mtitles(All All All 10 10 5 5 ) coeflabels(1.award "Grant" 1.post "Post" 1.award#1.post "Award $\times$ Post" ) keep(1.award#1.post) prehead(\begin{table}[htbp]\centering \def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi} \caption{Diff-in-diff models} \begin{tabular}{l*{7}{c}} \toprule) postfoot("") posthead(\midrule \textbf{Panel A: Patent}\\) booktabs nonotes indicate(/* "Age=age" "Age squared=c.age#c.age" */ "Rank $\times$ Award=*.award#c.rank"  `r(indicate_fe)') varwidth(25)
esttab est1 est2 est3 est4 est5 est6 est7 using $appendix/Table_K1.txt, append star(* 0.10 ** 0.05 *** 0.01 ) b(3) se(3) stats(N  N_clust r2, fmt(0 0 2) labels(N "\# competitions" "R-squared" )) mtitles(All All All 10 10 5 5 ) coeflabels(1.award "Grant" 1.post "Post" 1.award#1.post "Award $\times$ Post" ) keep(1.award#1.post) nonotes indicate(/* "Age=age" "Age squared=c.age#c.age" */ "Rank $\times$ Award=*.award#c.rank"  `r(indicate_fe)') varwidth(25)

* Two-period DID models for revenues
eststo clear
foreach var of varlist  turnover_mean {
eststo: qui reghdfe `var' i.award##i.post i.award#c.rank   if phase_smei==2  , a(year competition) cluster(competition)
eststo: qui reghdfe `var' i.award##i.post i.award#c.rank   if phase_smei==2  , a(year competition year_of_incorporation nace2 Country_iso_code) cluster(competition)
eststo: qui reghdfe `var' i.award##i.post                  if phase_smei==2  , a(year id ) cluster(competition)
eststo: qui reghdfe `var' i.award##i.post i.award#c.rank   if phase_smei==2  & inrange(rank,-10,10), a(year competition  year_of_incorporation nace2 Country_iso_code) cluster(competition)
eststo: qui reghdfe `var' i.award##i.post                  if phase_smei==2  & inrange(rank,-10,10), a(year id ) cluster(competition)
eststo: qui reghdfe `var' i.award##i.post i.award#c.rank   if phase_smei==2  & inrange(rank,-5,5), a(year competition  year_of_incorporation nace2 Country_iso_code) cluster(competition)
eststo: qui reghdfe `var' i.award##i.post                  if phase_smei==2  & inrange(rank,-5,5), a(year   id ) cluster(competition)
}
estfe . est*, labels(nace2 "Sector FE" year_of_incorporation "Cohort FE" competition "Competition FE" year "Year FE" Country_iso_code "Country FE" id "Firm-application FE")
esttab est1 est2 est3 est4 est5 est6 est7 using $appendix/Table_K2.tex, replace star(* 0.10 ** 0.05 *** 0.01 ) b(3) se(3) stats(N  N_clust r2, fmt(0 0 2) labels(N "\# competitions" "R-squared" )) mtitles(All All All 10 10 5 5 ) coeflabels(1.award "Grant" 1.post "Post" 1.award#1.post "Award $\times$ Post" ) keep(1.award#1.post) prehead(\begin{table}[htbp]\centering \def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi} \caption{Diff-in-diff models} \begin{tabular}{l*{7}{c}} \toprule) postfoot("") posthead(\midrule \textbf{Panel A: Patent}\\) booktabs nonotes indicate(/* "Age=age" "Age squared=c.age#c.age" */ "Rank $\times$ Award=*.award#c.rank"  `r(indicate_fe)') varwidth(25)
esttab est1 est2 est3 est4 est5 est6 est7 using $appendix/Table_K2.txt, replace star(* 0.10 ** 0.05 *** 0.01 ) b(3) se(3) stats(N  N_clust r2, fmt(0 0 2) labels(N "\# competitions" "R-squared" )) mtitles(All All All 10 10 5 5 ) coeflabels(1.award "Grant" 1.post "Post" 1.award#1.post "Award $\times$ Post" ) keep(1.award#1.post) nonotes indicate(/* "Age=age" "Age squared=c.age#c.age" */ "Rank $\times$ Award=*.award#c.rank"  `r(indicate_fe)') varwidth(25)

* Two-period DID models for assets
eststo clear
foreach var of varlist  totalassets_mean {
eststo: qui reghdfe `var' i.award##i.post i.award#c.rank   if phase_smei==2 , a(year competition) cluster(competition)
eststo: qui reghdfe `var' i.award##i.post i.award#c.rank   if phase_smei==2  , a(year competition year_of_incorporation nace2 Country_iso_code) cluster(competition)
eststo: qui reghdfe `var' i.award##i.post                  if phase_smei==2  , a(year id ) cluster(competition)
eststo: qui reghdfe `var' i.award##i.post i.award#c.rank   if phase_smei==2  & inrange(rank,-10,10), a(year competition  year_of_incorporation nace2 Country_iso_code) cluster(competition)
eststo: qui reghdfe `var' i.award##i.post                  if phase_smei==2  & inrange(rank,-10,10), a(year id ) cluster(competition)
eststo: qui reghdfe `var' i.award##i.post i.award#c.rank   if phase_smei==2  & inrange(rank,-5,5), a(year competition  year_of_incorporation nace2 Country_iso_code) cluster(competition)
eststo: qui reghdfe `var' i.award##i.post                  if phase_smei==2  & inrange(rank,-5,5), a(year   id ) cluster(competition)
}
estfe . est*, labels(nace2 "Sector FE" year_of_incorporation "Cohort FE" competition "Competition FE" year "Year FE" Country_iso_code "Country FE" id "Firm-application FE")
esttab est1 est2 est3 est4 est5 est6 est7 using $appendix/Table_K2.tex, append star(* 0.10 ** 0.05 *** 0.01 ) b(3) se(3) stats(N  N_clust r2, fmt(0 0 2) labels(N "\# competitions" "R-squared" )) mtitles(All All All 10 10 5 5 ) coeflabels(1.award "Grant" 1.post "Post" 1.award#1.post "Award $\times$ Post" ) keep(1.award#1.post) prehead(\begin{table}[htbp]\centering \def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi} \caption{Diff-in-diff models} \begin{tabular}{l*{7}{c}} \toprule) postfoot("") posthead(\midrule \textbf{Panel A: Patent}\\) booktabs nonotes indicate(/* "Age=age" "Age squared=c.age#c.age" */ "Rank $\times$ Award=*.award#c.rank"  `r(indicate_fe)') varwidth(25)
esttab est1 est2 est3 est4 est5 est6 est7 using $appendix/Table_K2.txt, append star(* 0.10 ** 0.05 *** 0.01 ) b(3) se(3) stats(N  N_clust r2, fmt(0 0 2) labels(N "\# competitions" "R-squared" )) mtitles(All All All 10 10 5 5 ) coeflabels(1.award "Grant" 1.post "Post" 1.award#1.post "Award $\times$ Post" ) keep(1.award#1.post) nonotes indicate(/* "Age=age" "Age squared=c.age#c.age" */ "Rank $\times$ Award=*.award#c.rank"  `r(indicate_fe)') varwidth(25)

* Two-period DID models for employment
eststo clear
foreach var of varlist   employees_mean {
eststo: qui reghdfe `var' i.award##i.post i.award#c.rank   if phase_smei==2 , a(year competition) cluster(competition)
eststo: qui reghdfe `var' i.award##i.post i.award#c.rank   if phase_smei==2 , a(year competition year_of_incorporation nace2 Country_iso_code) cluster(competition)
eststo: qui reghdfe `var' i.award##i.post                  if phase_smei==2 , a(year id ) cluster(competition)
eststo: qui reghdfe `var' i.award##i.post i.award#c.rank   if phase_smei==2  & inrange(rank,-10,10), a(year competition  year_of_incorporation nace2 Country_iso_code) cluster(competition)
eststo: qui reghdfe `var' i.award##i.post                  if phase_smei==2  & inrange(rank,-10,10), a(year id ) cluster(competition)
eststo: qui reghdfe `var' i.award##i.post i.award#c.rank   if phase_smei==2  & inrange(rank,-5,5), a(year competition  year_of_incorporation nace2 Country_iso_code) cluster(competition)
eststo: qui reghdfe `var' i.award##i.post                  if phase_smei==2  & inrange(rank,-5,5), a(year   id ) cluster(competition)
}
estfe . est*, labels(nace2 "Sector FE" year_of_incorporation "Cohort FE" competition "Competition FE" year "Year FE" Country_iso_code "Country FE" id "Firm-application FE")
esttab est1 est2 est3 est4 est5 est6 est7 using $appendix/Table_K2.tex, append star(* 0.10 ** 0.05 *** 0.01 ) b(3) se(3) stats(N  N_clust r2, fmt(0 0 2) labels(N "\# competitions" "R-squared" )) mtitles(All All All 10 10 5 5 ) coeflabels(1.award "Grant" 1.post "Post" 1.award#1.post "Award $\times$ Post" ) keep(1.award#1.post) prehead(\begin{table}[htbp]\centering \def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi} \caption{Diff-in-diff models} \begin{tabular}{l*{7}{c}} \toprule) postfoot("") posthead(\midrule \textbf{Panel A: Patent}\\) booktabs nonotes indicate(/* "Age=age" "Age squared=c.age#c.age" */ "Rank $\times$ Award=*.award#c.rank"  `r(indicate_fe)') varwidth(25)
esttab est1 est2 est3 est4 est5 est6 est7 using $appendix/Table_K2.txt, append star(* 0.10 ** 0.05 *** 0.01 ) b(3) se(3) stats(N  N_clust r2, fmt(0 0 2) labels(N "\# competitions" "R-squared" )) mtitles(All All All 10 10 5 5 ) coeflabels(1.award "Grant" 1.post "Post" 1.award#1.post "Award $\times$ Post" ) keep(1.award#1.post) nonotes indicate(/* "Age=age" "Age squared=c.age#c.age" */ "Rank $\times$ Award=*.award#c.rank"  `r(indicate_fe)') varwidth(25)



////////////// Appendix L

/// Table L1: Placebo tests 

use $data_path/DATA_ALL_FINAL.dta, clear

* compute dep vars in log levels
gen assets_post = ln(totalassets_tp1)
gen revenues_post = ln(opturnover_tp1)
gen employees_post = ln(numberofemployees_tp1)

foreach var of varlist assets_post revenues_post employees_post  {
		winsor2 `var', cuts(2 98) suff(_w)
}

* generate placebo thresholds above and below the real threshold
gen award_placebo1 = (rank>=2)
gen award_placebo2 = (rank>=-1)

* controls for polinomyal orders on both sides of the artificial thresholds
global linear1    c.rank#i.award_placebo1
global quadratic1 c.rank#i.award_placebo1 c.rank#c.rank#i.award_placebo1
global linear2    c.rank#i.award_placebo2
global quadratic2 c.rank#i.award_placebo2 c.rank#c.rank#i.award_placebo2

* reproducing Table 8
eststo clear
eststo: qui reghdfe ln_citw_patents_post_w award_placebo1 $quadratic1 ln_citw_patents_pre_w if phase_smei==2  & inrange(rank, 0,10), a(competition) cluster(competition) 
eststo: qui reghdfe ln_citw_patents_post_w award_placebo2 $linear2 ln_citw_patents_pre_w if phase_smei==2  & inrange(rank, -10,0), a(competition) cluster(competition) 
eststo: qui reghdfe ln_citw_patents_post_w award_placebo1 $linear1 ln_citw_patents_pre_w if phase_smei==2  & inrange(rank, 0,5), a(competition) cluster(competition) 
eststo: qui reghdfe ln_citw_patents_post_w award_placebo2 $linear2 ln_citw_patents_pre_w if phase_smei==2  & inrange(rank, -5,0), a(competition) cluster(competition) 

eststo: qui reghdfe pe_post award_placebo1 $linear1  pe_pre if phase_smei==2  & inrange(rank, 0,10), a(competition) cluster(competition) 
eststo: qui reghdfe pe_post award_placebo2 $linear2  pe_pre if phase_smei==2  & inrange(rank, -10,0), a(competition) cluster(competition) 
eststo: qui reghdfe pe_post award_placebo1 $linear1  pe_pre if phase_smei==2  & inrange(rank, 0,5), a(competition) cluster(competition) 
eststo: qui reghdfe pe_post award_placebo2 $linear2  pe_pre if phase_smei==2  & inrange(rank, -5,0), a(competition) cluster(competition) 
esttab est* using $output/Table_L1.txt, replace star(* 0.10 ** 0.05 *** 0.01 ) b(3) se(3) stats(N   r2, fmt(0  2) labels(N  "R-squared" )) keep(award_placebo1 award_placebo2) coeflabels(award_placebo1 "Placebo Grant (2)" award_placebo2 "Placebo Grant (-2)") mtitles(10 10 5 5 10 10 5 5)  indicate( "Rank $\times$ Grant=*.award_placebo*#c.rank"  `r(indicate_fe)') varwidth(25)
esttab est* using $output/Table_L1.tex, replace star(* 0.10 ** 0.05 *** 0.01 ) b(3) se(3) stats(N   r2, fmt(0  2) labels(N  "R-squared" )) keep(award_placebo1 award_placebo2) coeflabels(award_placebo1 "Placebo Grant (2)" award_placebo2 "Placebo Grant (-2)") mtitles(10 10 5 5 10 10 5 5)  indicate( "Rank $\times$ Grant=*.award_placebo*#c.rank"  `r(indicate_fe)') varwidth(25)


eststo clear
foreach var in  "assets" "employees" "revenues"  {
eststo est_`var'_7:  qui reghdfe `var'_post_w  award_placebo1 $linear1     `var'_pre_w  if phase_smei==2  & inrange(rank, 0,10), a(competition) cluster(competition)
eststo est_`var'_8:  qui reghdfe `var'_post_w  award_placebo2 $linear2     `var'_pre_w  if phase_smei==2  & inrange(rank, -10,0), a(competition) cluster(competition)
eststo est_`var'_3:  qui reghdfe `var'_post_w  award_placebo1 $linear1     `var'_pre_w  if phase_smei==2  & inrange(rank, 0,5), a(competition) cluster(competition)
eststo est_`var'_4:  qui reghdfe `var'_post_w  award_placebo2 $linear2     `var'_pre_w  if phase_smei==2  & inrange(rank, -5,0), a(competition) cluster(competition)
}
esttab est_revenues_*  est_employees_*  using $output/Table_L1.txt, append star(* 0.10 ** 0.05 *** 0.01 ) b(3) se(3) stats(N  r2, fmt(0  2) labels(N  "R-squared" )) keep(award_placebo1 award_placebo2)  coeflabels(award_placebo1 "Placebo Grant (2)" award_placebo2 "Placebo Grant (-2)") mtitles(10 10 5 5 10 10 5 5) varwidth(25)
esttab est_revenues_*  est_employees_*  using $output/Table_L1.tex, append star(* 0.10 ** 0.05 *** 0.01 ) b(3) se(3) stats(N  r2, fmt(0  2) labels(N  "R-squared" )) keep(award_placebo1 award_placebo2)  coeflabels(award_placebo1 "Placebo Grant (2)" award_placebo2 "Placebo Grant (-2)") mtitles(10 10 5 5 10 10 5 5) varwidth(25)


eststo est_exit_1: qui reghdfe exit3 award_placebo1 $linear1  if phase_smei==2  & inrange(rank, 0,10), a(competition) cluster(competition) 
eststo est_exit_2: qui reghdfe exit3 award_placebo2 $linear2   if phase_smei==2  & inrange(rank, -10,0), a(competition) cluster(competition) 
eststo est_exit_3: qui reghdfe exit3 award_placebo1 $linear1   if phase_smei==2  & inrange(rank, 0,5), a(competition) cluster(competition) 
eststo est_exit_4: qui reghdfe exit3 award_placebo2 $linear2   if phase_smei==2  & inrange(rank, -5,0), a(competition) cluster(competition) 
esttab est_assets_* est_exit_* using $output/Table_L1.txt, append star(* 0.10 ** 0.05 *** 0.01 ) b(3) se(3) stats(N  r2, fmt(0  2) labels(N  "R-squared" )) keep(award_placebo1 award_placebo2)  coeflabels(award_placebo1 "Placebo Grant (2)" award_placebo2 "Placebo Grant (-2)") mtitles(10 10 5 5 10 10 5 5) varwidth(25)
esttab est_assets_* est_exit_* using $output/Table_L1.tex, append star(* 0.10 ** 0.05 *** 0.01 ) b(3) se(3) stats(N  r2, fmt(0  2) labels(N  "R-squared" )) keep(award_placebo1 award_placebo2)  coeflabels(award_placebo1 "Placebo Grant (2)" award_placebo2 "Placebo Grant (-2)") mtitles(10 10 5 5 10 10 5 5) varwidth(25)


/////////// Appendix M 


// Table M1: Treatment effects derivatives

use $data_path/DATA_ALL_FINAL.dta, clear

* compute dep vars in log levels
gen assets_post = ln(totalassets_tp1)
gen revenues_post = ln(opturnover_tp1)
gen employees_post = ln(numberofemployees_tp1)

foreach var of varlist assets_post revenues_post employees_post  {
		winsor2 `var', cuts(2 98) suff(_w)
}

eststo clear
foreach var in "ln_citw_patents"  {

eststo: qui reghdfe `var'_post_w award rank c.rank#i.award `var'_pre_w if phase_smei==2 & inrange(rank, -10,10), a(competition) cluster(competition)
eststo: qui reghdfe `var'_post_w award rank c.rank#i.award c.rank#c.rank#i.award `var'_pre_w if phase_smei==2 & inrange(rank, -10,10), a(competition) cluster(competition)
eststo: qui reghdfe `var'_post_w award rank c.rank#i.award `var'_pre_w if phase_smei==2 & inrange(rank, -5,5), a(competition) cluster(competition)
eststo: qui reghdfe `var'_post_w award rank c.rank#i.award c.rank#c.rank#i.award `var'_pre_w if phase_smei==2 & inrange(rank, -5,5), a(competition) cluster(competition)
}
estfe . est*, labels(nace1 "Sector FE" year_of_incorporation "Cohort FE"  coordinator_country "Country" competition "Competition FE")
esttab est* using $appendix/Table_M1.tex, replace star(* 0.10 ** 0.05 *** 0.01 ) b(3) se(3) stats(N  r2, fmt(0 2) labels(N  "R-squared" )) keep(1.award#c.rank) coeflabel(1.award#c.rank "TED") mtitles(10 10 5 5 )   prehead(\begin{table}[htbp]\centering \def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi} \caption{Alternative standard error clustering} \begin{tabular}{l*{5}{c}} \toprule) postfoot("") posthead(\midrule ) booktabs nonotes  varwidth(25)
esttab est* using $appendix/Table_M1.txt, replace star(* 0.10 ** 0.05 *** 0.01 ) b(3) se(3) stats(N  r2, fmt(0 2) labels(N  "R-squared" )) keep(1.award#c.rank) coeflabel(1.award#c.rank "TED") mtitles(10 10 5 5 )   nonotes  varwidth(25)

eststo clear
foreach var in "pe"  {

eststo: qui reghdfe `var'_post award rank c.rank#i.award `var'_pre if phase_smei==2 & inrange(rank, -10,10), a(competition) cluster(competition)
eststo: qui reghdfe `var'_post award rank c.rank#i.award c.rank#c.rank#i.award `var'_pre if phase_smei==2 & inrange(rank, -10,10), a(competition) cluster(competition)
eststo: qui reghdfe `var'_post award rank c.rank#i.award `var'_pre if phase_smei==2 & inrange(rank, -5,5), a(competition) cluster(competition)
eststo: qui reghdfe `var'_post award rank c.rank#i.award c.rank#c.rank#i.award `var'_pre if phase_smei==2 & inrange(rank, -5,5), a(competition) cluster(competition)
}
estfe . est*, labels(nace1 "Sector FE" year_of_incorporation "Cohort FE"  coordinator_country "Country" competition "Competition FE")
esttab est*   using $appendix/Table_M1.tex, append star(* 0.10 ** 0.05 *** 0.01 ) b(3) se(3) stats(N r2, fmt(0 2) labels(N   "R-squared"  )) keep(1.award#c.rank) coeflabel(1.award#c.rank "TED") mtitles(10 10 5 5) postfoot("") prefoot(\midrule) prehead("\midrule") posthead(\midrule )  booktabs  varwidth(25)
esttab est*   using $appendix/Table_M1.txt, append star(* 0.10 ** 0.05 *** 0.01 ) b(3) se(3) stats(N r2, fmt(0 2) labels(N   "R-squared"  )) keep(1.award#c.rank) coeflabel(1.award#c.rank "TED") mtitles(10 10 5 5) varwidth(25)

eststo clear
foreach var in "investment"  {

eststo: qui reghdfe `var'_post_w award rank c.rank#i.award fixed_assets_pre_w if phase_smei==2 & inrange(rank, -10,10), a(competition) cluster(competition)
eststo: qui reghdfe `var'_post_w award rank c.rank#i.award c.rank#c.rank#i.award fixed_assets_pre_w if phase_smei==2 & inrange(rank, -10,10), a(competition) cluster(competition)
eststo: qui reghdfe `var'_post_w award rank c.rank#i.award fixed_assets_pre_w if phase_smei==2 & inrange(rank, -5,5), a(competition) cluster(competition)
eststo: qui reghdfe `var'_post_w award rank c.rank#i.award c.rank#c.rank#i.award fixed_assets_pre_w if phase_smei==2 & inrange(rank, -5,5), a(competition) cluster(competition)
}
esttab , keep(1.award#c.rank) coeflabel(1.award#c.rank "TED") star(* 0.10 ** 0.05 *** 0.01 ) b(3) se(3)
estfe . est*, labels(nace1 "Sector FE" year_of_incorporation "Cohort FE"  coordinator_country "Country" competition "Competition FE")
esttab est*   using $appendix/Table_M1.tex, append star(* 0.10 ** 0.05 *** 0.01 ) b(3) se(3) stats(N r2, fmt(0 2) labels(N   "R-squared"  )) keep(1.award#c.rank) coeflabel(1.award#c.rank "TED") mtitles(10 10 5 5) postfoot("") prefoot(\midrule) prehead("\midrule") posthead(\midrule )  booktabs  varwidth(25)
esttab est*   using $appendix/Table_M1.txt, append star(* 0.10 ** 0.05 *** 0.01 ) b(3) se(3) stats(N r2, fmt(0 2) labels(N   "R-squared"  )) keep(1.award#c.rank) coeflabel(1.award#c.rank "TED") mtitles(10 10 5 5)  varwidth(25)


eststo clear
foreach var in  "assets" "employees" "revenues" {

eststo: qui reghdfe `var'_post_w award rank c.rank#i.award `var'_pre_w if phase_smei==2 & inrange(rank, -10,10), a(competition) cluster(competition)
eststo: qui reghdfe `var'_post_w award rank c.rank#i.award c.rank#c.rank#i.award `var'_pre_w if phase_smei==2 & inrange(rank, -10,10), a(competition) cluster(competition)
eststo: qui reghdfe `var'_post_w award rank c.rank#i.award `var'_pre_w if phase_smei==2 & inrange(rank, -5,5), a(competition) cluster(competition)
eststo: qui reghdfe `var'_post_w award rank c.rank#i.award c.rank#c.rank#i.award `var'_pre_w if phase_smei==2 & inrange(rank, -5,5), a(competition) cluster(competition)
}
esttab est1 est2 est3 est4 , keep(1.award#c.rank) coeflabel(1.award#c.rank "TED") star(* 0.10 ** 0.05 *** 0.01 ) b(3) se(3)
esttab est5 est6 est7 est8 , keep(1.award#c.rank) coeflabel(1.award#c.rank "TED") star(* 0.10 ** 0.05 *** 0.01 ) b(3) se(3)
esttab est9 est10 est11 est12 , keep(1.award#c.rank) coeflabel(1.award#c.rank "TED") star(* 0.10 ** 0.05 *** 0.01 ) b(3) se(3)
estfe . est*, labels(nace1 "Sector FE" year_of_incorporation "Cohort FE"  coordinator_country "Country" competition "Competition FE")
esttab est1 est2 est3 est4   using $appendix/Table_M1.tex, append star(* 0.10 ** 0.05 *** 0.01 ) b(3) se(3) stats(N r2, fmt(0 2) labels(N   "R-squared"  )) keep(1.award#c.rank) coeflabel(1.award#c.rank "TED") mtitles(10 10 5 5) postfoot("") prefoot(\midrule) prehead("\midrule") posthead(\midrule )  booktabs  varwidth(25)
estfe . est*, labels(nace1 "Sector FE" year_of_incorporation "Cohort FE"  coordinator_country "Country" competition "Competition FE")
esttab est5 est6 est7 est8   using $appendix/Table_M1.tex, append star(* 0.10 ** 0.05 *** 0.01 ) b(3) se(3) stats(N r2, fmt(0 2) labels(N   "R-squared"  )) keep(1.award#c.rank) coeflabel(1.award#c.rank "TED") mtitles(10 10 5 5) postfoot("") prefoot(\midrule) prehead("\midrule") posthead(\midrule )  booktabs  varwidth(25)
estfe . est*, labels(nace1 "Sector FE" year_of_incorporation "Cohort FE"  coordinator_country "Country" competition "Competition FE")
esttab est9 est10 est11 est12   using $appendix/Table_M1.tex, append star(* 0.10 ** 0.05 *** 0.01 ) b(3) se(3) stats(N r2, fmt(0 2) labels(N   "R-squared"  )) keep(1.award#c.rank) coeflabel(1.award#c.rank "TED") mtitles(10 10 5 5) postfoot("") prefoot(\midrule) prehead("\midrule") posthead(\midrule )  booktabs  varwidth(25)
esttab est1 est2 est3 est4   using $appendix/Table_M1.txt, append star(* 0.10 ** 0.05 *** 0.01 ) b(3) se(3) stats(N r2, fmt(0 2) labels(N   "R-squared"  )) keep(1.award#c.rank) coeflabel(1.award#c.rank "TED") mtitles(10 10 5 5)  varwidth(25)
estfe . est*, labels(nace1 "Sector FE" year_of_incorporation "Cohort FE"  coordinator_country "Country" competition "Competition FE")
esttab est5 est6 est7 est8   using $appendix/Table_M1.txt, append star(* 0.10 ** 0.05 *** 0.01 ) b(3) se(3) stats(N r2, fmt(0 2) labels(N   "R-squared"  )) keep(1.award#c.rank) coeflabel(1.award#c.rank "TED") mtitles(10 10 5 5) varwidth(25)
estfe . est*, labels(nace1 "Sector FE" year_of_incorporation "Cohort FE"  coordinator_country "Country" competition "Competition FE")
esttab est9 est10 est11 est12   using $appendix/Table_M1.txt, append star(* 0.10 ** 0.05 *** 0.01 ) b(3) se(3) stats(N r2, fmt(0 2) labels(N   "R-squared"  )) keep(1.award#c.rank) coeflabel(1.award#c.rank "TED") mtitles(10 10 5 5)  varwidth(25)


eststo clear
foreach var in "exit3"  {

eststo: qui reghdfe `var' award rank c.rank#i.award  if phase_smei==2 & inrange(rank, -10,10), a(competition) cluster(competition)
eststo: qui reghdfe `var' award rank c.rank#i.award c.rank#c.rank#i.award if phase_smei==2 & inrange(rank, -10,10), a(competition) cluster(competition)
eststo: qui reghdfe `var' award rank c.rank#i.award  if phase_smei==2 & inrange(rank, -5,5), a(competition) cluster(competition)
eststo: qui reghdfe `var' award rank c.rank#i.award c.rank#c.rank#i.award if phase_smei==2 & inrange(rank, -5,5), a(competition) cluster(competition)
}
esttab , keep(1.award#c.rank) coeflabel(1.award#c.rank "TED") star(* 0.10 ** 0.05 *** 0.01 ) b(3) se(3)
estfe . est*, labels(nace1 "Sector FE" year_of_incorporation "Cohort FE"  coordinator_country "Country" competition "Competition FE")
esttab est*   using $appendix/Table_M1.tex, append star(* 0.10 ** 0.05 *** 0.01 ) b(3) se(3) stats(N r2, fmt(0 2) labels(N   "R-squared"  )) keep(1.award#c.rank) coeflabel(1.award#c.rank "TED") mtitles(10 10 5 5) postfoot("") prefoot(\midrule) prehead("\midrule") posthead(\midrule )  booktabs  varwidth(25)
esttab est*   using $appendix/Table_M1.txt, append star(* 0.10 ** 0.05 *** 0.01 ) b(3) se(3) stats(N r2, fmt(0 2) labels(N   "R-squared"  )) keep(1.award#c.rank) coeflabel(1.award#c.rank "TED") mtitles(10 10 5 5)  varwidth(25)
		
	


